Encoding and decoding of significant coefficients in dependence upon a parameter of the significant coefficients

ABSTRACT

A data encoding method for encoding an array of data values as data sets and escape codes for values not encoded by the data sets, an escape code including a unary coded portion and a non-unary coded portion, the method including: setting a coding parameter defining a minimum number of bits of a non-unary coded portion; adding an offset value of 1 or more to the coding parameter to define a minimum least significant data portion size; generating one or more data sets indicative of positions, relative to the array of data values, of data values of predetermined magnitude ranges, to encode the value of at least one least significant bit of each data value; generating respective complementary most-significant data portions and least-significant data portions; encoding the data sets; encoding the most significant data portions; and encoding the least-significant portions.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a continuation of U.S. application Ser. No. 14/779,502, filedSep. 23, 2015, which is a U.S. National Stage application ofInternational Application No. PCT/GB2014/051065, filed Apr. 4, 2014,which claims priority to United Kingdom Application No. 1306335.9, filedApr. 8, 2013, United Kingdom Application No. 1307121.2, filed Apr. 19,2013, United Kingdom Application No. 1312330.2, filed Jul. 9, 2013, andUnited Kingdom Application No. 1320775.8, filed Nov. 25, 2013, theentire contents of which are incorporated herein by reference.

FIELD OF THE INVENTION

This disclosure relates to data encoding and decoding.

DESCRIPTION OF THE RELATED ART

The “background” description provided herein is for the purpose ofgenerally presenting the context of the disclosure. Work of thepresently named inventors, to the extent it is described in thisbackground section, as well as aspects of the description which may nototherwise qualify as prior art at the time of filing, are neitherexpressly or impliedly admitted as prior art against the presentdisclosure.

There are several video data compression and decompression systems whichinvolve transforming video data into a frequency domain representation,quantising the frequency domain coefficients and then applying some formof entropy encoding to the quantised coefficients.

Entropy, in the present context, can be considered as representing theinformation content of a data symbol or series of symbols. The aim ofentropy encoding is to encode a series of data symbols in a losslessmanner using (ideally) the smallest number of encoded data bits whichare necessary to represent the information content of that series ofdata symbols. In practice, entropy encoding is used to encode thequantised coefficients such that the encoded data is smaller (in termsof its number of bits) than the data size of the original quantisedcoefficients. A more efficient entropy encoding process gives a smalleroutput data size for the same input data size.

One technique for entropy encoding video data is the so-called CABAC(context adaptive binary arithmetic coding) technique.

SUMMARY

This disclosure provides a data encoding method according to claim 1.

Further respective aspects and features are defined in the appendedclaims.

It is to be understood that both the foregoing general description andthe following detailed description are exemplary, but not restrictiveof, the present disclosure.

BRIEF DESCRIPTION OF THE DRAWINGS

A more complete appreciation of the disclosure and many of the attendantadvantages thereof will be readily obtained as the same becomes betterunderstood by reference to the following detailed description ofembodiments, when considered in connection with the accompanyingdrawings, wherein:

FIG. 1 schematically illustrates an audio/video (A/V) data transmissionand reception system using video data compression and decompression;

FIG. 2 schematically illustrates a video display system using video datadecompression;

FIG. 3 schematically illustrates an audio/video storage system usingvideo data compression and decompression;

FIG. 4 schematically illustrates a video camera using video datacompression;

FIG. 5 provides a schematic overview of a video data compression anddecompression apparatus;

FIG. 6 schematically illustrates the generation of predicted images;

FIG. 7 schematically illustrates a largest coding unit (LCU);

FIG. 8 schematically illustrates a set of four coding units (CU);

FIGS. 9 and 10 schematically illustrate the coding units of FIG. 8sub-divided into smaller coding units;

FIG. 11 schematically illustrates an array of prediction units (PU);

FIG. 12 schematically illustrates an array of transform units (TU);

FIG. 13 schematically illustrates a partially-encoded image;

FIG. 14 schematically illustrates a set of possible predictiondirections;

FIG. 15 schematically illustrates a set of prediction modes;

FIG. 16 schematically illustrates a zigzag scan;

FIG. 17 schematically illustrates a CABAC entropy encoder;

FIGS. 18A to 18D schematically illustrate aspects of a CABAC encodingand decoding operation;

FIG. 19 schematically illustrates a CABAC encoder;

FIG. 20 schematically illustrates a CABAC decoder;

FIG. 21 is a schematic diagram showing an overview of an encodingsystem;

FIG. 22 is a graph of bit rate against quantisation parameter (QP);

FIG. 23 is a graph of bit rate against green channel PSNR for six testbit depths, with a transform skip mode enabled;

FIG. 24 is a graph of bit rate against green channel PSNR for six testbit depths, with a transform skip mode disabled;

FIG. 25 is a graph of bit rate against green channel PSNR for six testbit depths, with 14 bit transform matrices;

FIG. 26 is a graph of PSNR against bit rate for one test sequencecomparing various precision DCT matrices;

FIG. 27 is a graph of PSNR against bit rate for one test sequenceshowing the use of bypass fixed-bit encoding;

FIG. 28 is a table providing examples of encoding profiles;

FIGS. 29 to 31 are schematic flowcharts respectively illustratingversions of part of a CABAC process;

FIGS. 32A-F are schematic diagrams illustrating different CABACalignment schemes;

FIGS. 33 to 35 are schematic flowcharts respectively illustratingversions of a termination stage of a CABAC process;

FIG. 36 is a flowchart schematically illustrating a coding technique;

FIG. 37 is a flowchart schematically illustrating an adaptationtechnique; and

FIGS. 38 and 39 are schematic flowcharts illustrating a process forselecting transform dynamic range and data precision parameters.

DESCRIPTION OF THE EMBODIMENTS

Referring now to the drawings, FIGS. 1-4 are provided to give schematicillustrations of apparatus or systems making use of the compressionand/or decompression apparatus to be described below in connection withembodiments.

All of the data compression and/or decompression apparatus is to bedescribed below may be implemented in hardware, in software running on ageneral-purpose data processing apparatus such as a general-purposecomputer, as programmable hardware such as an application specificintegrated circuit (ASIC) or field programmable gate array (FPGA) or ascombinations of these. In cases where the embodiments are implemented bysoftware and/or firmware, it will be appreciated that such softwareand/or firmware, and non-transitory machine-readable data storage mediaby which such software and/or firmware are stored or otherwise provided,are considered as embodiments.

FIG. 1 schematically illustrates an audio/video data transmission andreception system using video data compression and decompression.

An input audio/video signal 10 is supplied to a video data compressionapparatus 20 which compresses at least the video component of theaudio/video signal 10 for transmission along a transmission route 30such as a cable, an optical fibre, a wireless link or the like. Thecompressed signal is processed by a decompression apparatus 40 toprovide an output audio/video signal 50. For the return path, acompression apparatus 60 compresses an audio/video signal fortransmission along the transmission route 30 to a decompressionapparatus 70.

The compression apparatus 20 and decompression apparatus 70 cantherefore form one node of a transmission link. The decompressionapparatus 40 and decompression apparatus 60 can form another node of thetransmission link. Of course, in instances where the transmission linkis uni-directional, only one of the nodes would require a compressionapparatus and the other node would only require a decompressionapparatus.

FIG. 2 schematically illustrates a video display system using video datadecompression. In particular, a compressed audio/video signal 100 isprocessed by a decompression apparatus 110 to provide a decompressedsignal which can be displayed on a display 120. The decompressionapparatus 110 could be implemented as an integral part of the display120, for example being provided within the same casing as the displaydevice. Alternatively, the decompression apparatus 110 might be providedas (for example) a so-called set top box (STB), noting that theexpression “set-top” does not imply a requirement for the box to besited in any particular orientation or position with respect to thedisplay 120; it is simply a term used in the art to indicate a devicewhich is connectable to a display as a peripheral device.

FIG. 3 schematically illustrates an audio/video storage system usingvideo data compression and decompression. An input audio/video signal130 is supplied to a compression apparatus 140 which generates acompressed signal for storing by a store device 150 such as a magneticdisk device, an optical disk device, a magnetic tape device, a solidstate storage device such as a semiconductor memory or other storagedevice. For replay, compressed data is read from the store device 150and passed to a decompression apparatus 160 for decompression to providean output audio/video signal 170.

It will be appreciated that the compressed or encoded signal, and astorage medium or data carrier storing that signal, are considered asembodiments.

FIG. 4 schematically illustrates a video camera using video datacompression. In FIG. 4, and image capture device 180, such as a chargecoupled device (CCD) image sensor and associated control and read-outelectronics, generates a video signal which is passed to a compressionapparatus 190. A microphone (or plural microphones) 200 generates anaudio signal to be passed to the compression apparatus 190. Thecompression apparatus 190 generates a compressed audio/video signal 210to be stored and/or transmitted (shown generically as a schematic stage220).

The techniques to be described below relate primarily to video datacompression. It will be appreciated that many existing techniques may beused for audio data compression in conjunction with the video datacompression techniques which will be described, to generate a compressedaudio/video signal. Accordingly, a separate discussion of audio datacompression will not be provided. It will also be appreciated that thedata rate associated with video data, in particular broadcast qualityvideo data, is generally very much higher than the data rate associatedwith audio data (whether compressed or uncompressed). It will thereforebe appreciated that uncompressed audio data could accompany compressedvideo data to form a compressed audio/video signal. It will further beappreciated that although the present examples (shown in FIGS. 1-4)relate to audio/video data, the techniques to be described below canfind use in a system which simply deals with (that is to say,compresses, decompresses, stores, displays and/or transmits) video data.That is to say, the embodiments can apply to video data compressionwithout necessarily having any associated audio data handling at all.

FIG. 5 provides a schematic overview of a video data compression anddecompression apparatus.

Successive images of an input video signal 300 are supplied to an adder310 and to an image predictor 320. The image predictor 320 will bedescribed below in more detail with reference to FIG. 6. The adder 310in fact performs a subtraction (negative addition) operation, in that itreceives the input video signal 300 on a “+” input and the output of theimage predictor 320 on a “−” input, so that the predicted image issubtracted from the input image. The result is to generate a so-calledresidual image signal 330 representing the difference between the actualand projected images.

One reason why a residual image signal is generated is as follows. Thedata coding techniques to be described, that is to say the techniqueswhich will be applied to the residual image signal, tends to work moreefficiently when there is less “energy” in the image to be encoded.Here, the term “efficiently” refers to the generation of a small amountof encoded data; for a particular image quality level, it is desirable(and considered “efficient”) to generate as little data as ispracticably possible. The reference to “energy” in the residual imagerelates to the amount of information contained in the residual image. Ifthe predicted image were to be identical to the real image, thedifference between the two (that is to say, the residual image) wouldcontain zero information (zero energy) and would be very easy to encodeinto a small amount of encoded data. In general, if the predictionprocess can be made to work reasonably well, the expectation is that theresidual image data will contain less information (less energy) than theinput image and so will be easier to encode into a small amount ofencoded data.

The residual image data 330 is supplied to a transform unit 340 whichgenerates a discrete cosine transform (DCT) representation of theresidual image data. The DCT technique itself is well known and will notbe described in detail here. There are however aspects of the techniquesused in the present apparatus which will be described in more detailbelow, in particular relating to the selection of different blocks ofdata to which the DCT operation is applied. These will be discussed withreference to FIGS. 7-12 below.

Note that in some embodiments, a discrete sine transform (DST) is usedinstead of a DCT. In other embodiments, no transform might be used. Thiscan be done selectively, so that the transform stage is, in effect,bypassed, for example under the control of a “transform skip” command ormode.

The output of the transform unit 340, which is to say, a set oftransform coefficients for each transformed block of image data, issupplied to a quantiser 350. Various quantisation techniques are knownin the field of video data compression, ranging from a simplemultiplication by a quantisation scaling factor through to theapplication of complicated lookup tables under the control of aquantisation parameter. The general aim is twofold. Firstly, thequantisation process reduces the number of possible values of thetransformed data. Secondly, the quantisation process can increase thelikelihood that values of the transformed data are zero. Both of thesecan make the entropy encoding process, to be described below, work moreefficiently in generating small amounts of compressed video data.

A data scanning process is applied by a scan unit 360. The purpose ofthe scanning process is to reorder the quantised transformed data so asto gather as many as possible of the non-zero quantised transformedcoefficients together, and of course therefore to gather as many aspossible of the zero-valued coefficients together. These features canallow so-called run-length coding or similar techniques to be appliedefficiently. So, the scanning process involves selecting coefficientsfrom the quantised transformed data, and in particular from a block ofcoefficients corresponding to a block of image data which has beentransformed and quantised, according to a “scanning order” so that (a)all of the coefficients are selected once as part of the scan, and (b)the scan tends to provide the desired reordering. Techniques forselecting a scanning order will be described below. One example scanningorder which can tend to give useful results is a so-called zigzagscanning order.

The scanned coefficients are then passed to an entropy encoder (EE) 370.Again, various types of entropy encoding may be used. Two examples whichwill be described below are variants of the so-called CABAC (ContextAdaptive Binary Arithmetic Coding) system and variants of the so-calledCAVLC (Context Adaptive Variable-Length Coding) system. In generalterms, CABAC is considered to provide a better efficiency, and in somestudies has been shown to provide a 10-20% reduction in the quantity ofencoded output data for a comparable image quality compared to CAVLC.However, CAVLC is considered to represent a much lower level ofcomplexity (in terms of its implementation) than CABAC. The CABACtechnique will be discussed with reference to FIG. 17 below, and theCAVLC technique will be discussed with reference to FIGS. 18 and 19below.

Note that the scanning process and the entropy encoding process areshown as separate processes, but in fact can be combined or treatedtogether. That is to say, the reading of data into the entropy encodercan take place in the scan order. Corresponding considerations apply tothe respective inverse processes to be described below.

The output of the entropy encoder 370, along with additional data(mentioned above and/or discussed below), for example defining themanner in which the predictor 320 generated the predicted image,provides a compressed output video signal 380.

However, a return path is also provided because the operation of thepredictor 320 itself depends upon a decompressed version of thecompressed output data.

The reason for this feature is as follows. At the appropriate stage inthe decompression process (to be described below) a decompressed versionof the residual data is generated. This decompressed residual data hasto be added to a predicted image to generate an output image (becausethe original residual data was the difference between the input imageand a predicted image). In order that this process is comparable, asbetween the compression side and the decompression side, the predictedimages generated by the predictor 320 should be the same during thecompression process and during the decompression process. Of course, atdecompression, the apparatus does not have access to the original inputimages, but only to the decompressed images. Therefore, at compression,the predictor 320 bases its prediction (at least, for inter-imageencoding) on decompressed versions of the compressed images.

The entropy encoding process carried out by the entropy encoder 370 isconsidered to be “lossless”, which is to say that it can be reversed toarrive at exactly the same data which was first supplied to the entropyencoder 370. So, the return path can be implemented before the entropyencoding stage. Indeed, the scanning process carried out by the scanunit 360 is also considered lossless, but in the present embodiment thereturn path 390 is from the output of the quantiser 350 to the input ofa complimentary inverse quantiser 420.

In general terms, an entropy decoder 410, the reverse scan unit 400, aninverse quantiser 420 and an inverse transform unit 430 provide therespective inverse functions of the entropy encoder 370, the scan unit360, the quantiser 350 and the transform unit 340. For now, thediscussion will continue through the compression process; the process todecompress an input compressed video signal will be discussed separatelybelow.

In the compression process, the scanned coefficients are passed by thereturn path 390 from the quantiser 350 to the inverse quantiser 420which carries out the inverse operation of the scan unit 360. An inversequantisation and inverse transformation process are carried out by theunits 420, 430 to generate a compressed-decompressed residual imagesignal 440.

The image signal 440 is added, at an adder 450, to the output of thepredictor 320 to generate a reconstructed output image 460. This formsone input to the image predictor 320, as will be described below.

Turning now to the process applied to a received compressed video signal470, the signal is supplied to the entropy decoder 410 and from there tothe chain of the reverse scan unit 400, the inverse quantiser 420 andthe inverse transform unit 430 before being added to the output of theimage predictor 320 by the adder 450. In straightforward terms, theoutput 460 of the adder 450 forms the output decompressed video signal480. In practice, further filtering may be applied before the signal isoutput.

FIG. 6 schematically illustrates the generation of predicted images, andin particular the operation of the image predictor 320.

There are two basic modes of prediction: so-called intra-imageprediction and so-called inter-image, or motion-compensated (MC),prediction.

Intra-image prediction bases a prediction of the content of a block ofthe image on data from within the same image. This corresponds toso-called I-frame encoding in other video compression techniques. Incontrast to I-frame encoding, where the whole image is intra-encoded, inthe present embodiments the choice between intra- and inter-encoding canbe made on a block-by-block basis, though in other embodiments thechoice is still made on an image-by-image basis.

Motion-compensated prediction makes use of motion information whichattempts to define the source, in another adjacent or nearby image, ofimage detail to be encoded in the current image. Accordingly, in anideal example, the contents of a block of image data in the predictedimage can be encoded very simply as a reference (a motion vector)pointing to a corresponding block at the same or a slightly differentposition in an adjacent image.

Returning to FIG. 6, two image prediction arrangements (corresponding tointra- and inter-image prediction) are shown, the results of which areselected by a multiplexer 500 under the control of a mode signal 510 soas to provide blocks of the predicted image for supply to the adders 310and 450. The choice is made in dependence upon which selection gives thelowest “energy” (which, as discussed above, may be considered asinformation content requiring encoding), and the choice is signalled tothe encoder within the encoded output datastream. Image energy, in thiscontext, can be detected, for example, by carrying out a trialsubtraction of an area of the two versions of the predicted image fromthe input image, squaring each pixel value of the difference image,summing the squared values, and identifying which of the two versionsgives rise to the lower mean squared value of the difference imagerelating to that image area.

The actual prediction, in the intra-encoding system, is made on thebasis of image blocks received as part of the signal 460, which is tosay, the prediction is based upon encoded-decoded image blocks in orderthat exactly the same prediction can be made at a decompressionapparatus. However, data can be derived from the input video signal 300by an intra-mode selector 520 to control the operation of theintra-image predictor 530.

For inter-image prediction, a motion compensated (MC) predictor 540 usesmotion information such as motion vectors derived by a motion estimator550 from the input video signal 300. Those motion vectors are applied toa processed version of the reconstructed image 460 by the motioncompensated predictor 540 to generate blocks of the inter-imageprediction.

The processing applied to the signal 460 will now be described. Firstly,the signal is filtered by a filter unit 560. This involves applying a“deblocking” filter to remove or at least tend to reduce the effects ofthe block-based processing carried out by the transform unit 340 andsubsequent operations. Also, an adaptive loop filter is applied usingcoefficients derived by processing the reconstructed signal 460 and theinput video signal 300. The adaptive loop filter is a type of filterwhich, using known techniques, applies adaptive filter coefficients tothe data to be filtered. That is to say, the filter coefficients canvary in dependence upon various factors. Data defining which filtercoefficients to use is included as part of the encoded outputdatastream.

The filtered output from the filter unit 560 in fact forms the outputvideo signal 480. It is also buffered in one or more image stores 570;the storage of successive images is a requirement of motion compensatedprediction processing, and in particular the generation of motionvectors. To save on storage requirements, the stored images in the imagestores 570 may be held in a compressed form and then decompressed foruse in generating motion vectors. For this particular purpose, any knowncompression/decompression system may be used. The stored images arepassed to an interpolation filter 580 which generates a higherresolution version of the stored images; in this example, intermediatesamples (sub-samples) are generated such that the resolution of theinterpolated image is output by the interpolation filter 580 is 8 times(in each dimension) that of the images stored in the image stores 570.The interpolated images are passed as an input to the motion estimator550 and also to the motion compensated predictor 540.

In embodiments, a further optional stage is provided, which is tomultiply the data values of the input video signal by a factor of fourusing a multiplier 600 (effectively just shifting the data values leftby two bits), and to apply a corresponding divide operation (shift rightby two bits) at the output of the apparatus using a divider orright-shifter 610. So, the shifting left and shifting right changes thedata purely for the internal operation of the apparatus. This measurecan provide for higher calculation accuracy within the apparatus, as theeffect of any data rounding errors is reduced.

The way in which an image is partitioned for compression processing willnow be described. At a basic level, and image to be compressed isconsidered as an array of blocks of samples. For the purposes of thepresent discussion, the largest such block under consideration is aso-called largest coding unit (LCU) 700 (FIG. 7), which represents asquare array of 64×64 samples. Here, the discussion relates to luminancesamples. Depending on the chrominance mode, such as 4:4:4, 4:2:2, 4:2:0or 4:4:4:4 (GBR plus key data), there will be differing numbers ofcorresponding chrominance samples corresponding to the luminance block.

Three basic types of blocks will be described: coding units, predictionunits and transform units. In general terms, the recursive subdividingof the LCUs allows an input picture to be partitioned in such a way thatboth the block sizes and the block coding parameters (such as predictionor residual coding modes) can be set according to the specificcharacteristics of the image to be encoded.

The LCU may be subdivided into so-called coding units (CU). Coding unitsare always square and have a size between 8×8 samples and the full sizeof the LCU 700. The coding units can be arranged as a kind of treestructure, so that a first subdivision may take place as shown in FIG.8, giving coding units 710 of 32×32 samples; subsequent subdivisions maythen take place on a selective basis so as to give some coding units 720of 16×16 samples (FIG. 9) and potentially some coding units 730 of 8×8samples (FIG. 10). Overall, this process can provide a content-adaptingcoding tree structure of CU blocks, each of which may be as large as theLCU or as small as 8×8 samples. Encoding of the output video data takesplace on the basis of the coding unit structure.

FIG. 11 schematically illustrates an array of prediction units (PU). Aprediction unit is a basic unit for carrying information relating to theimage prediction processes, or in other words the additional data addedto the entropy encoded residual image data to form the output videosignal from the apparatus of FIG. 5. In general, prediction units arenot restricted to being square in shape. They can take other shapes, inparticular rectangular shapes forming half of one of the square codingunits, as long as the coding unit is greater than the minimum (8×8)size. The aim is to allow the boundary of adjacent prediction units tomatch (as closely as possible) the boundary of real objects in thepicture, so that different prediction parameters can be applied todifferent real objects. Each coding unit may contain one or moreprediction units.

FIG. 12 schematically illustrates an array of transform units (TU). Atransform unit is a basic unit of the transform and quantisationprocess. Transform units are always square and can take a size from 4×4up to 32×32 samples. Each coding unit can contain one or more transformunits. The acronym SDIP-P in FIG. 12 signifies a so-called shortdistance intra-prediction partition. In this arrangement only onedimensional transforms are used, so a 4×N block is passed through Ntransforms with input data to the transforms being based upon thepreviously decoded neighbouring blocks and the previously decodedneighbouring lines within the current SDIP-P.

The intra-prediction process will now be discussed. In general terms,intra-prediction involves generating a prediction of a current block (aprediction unit) of samples from previously-encoded and decoded samplesin the same image. FIG. 13 schematically illustrates a partially encodedimage 800. Here, the image is being encoded from top-left tobottom-right on an LCU basis. An example LCU encoded partway through thehandling of the whole image is shown as a block 810. A shaded region 820above and to the left of the block 810 has already been encoded. Theintra-image prediction of the contents of the block 810 can make use ofany of the shaded area 820 but cannot make use of the unshaded areabelow that.

The block 810 represents an LCU; as discussed above, for the purposes ofintra-image prediction processing, this may be subdivided into a set ofsmaller prediction units. An example of a prediction unit 830 is shownwithin the LCU 810.

The intra-image prediction takes into account samples above and/or tothe left of the current LCU 810. Source samples, from which the requiredsamples are predicted, may be located at different positions ordirections relative to a current prediction unit within the LCU 810. Todecide which direction is appropriate for a current prediction unit, theresults of a trial prediction based upon each candidate direction arecompared in order to see which candidate direction gives an outcomewhich is closest to the corresponding block of the input image. Thecandidate direction giving the closest outcome is selected as theprediction direction for that prediction unit.

The picture may also be encoded on a “slice” basis. In one example, aslice is a horizontally adjacent group of LCUs. But in more generalterms, the entire residual image could form a slice, or a slice could bea single LCU, or a slice could be a row of LCUs, and so on. Slices cangive some resilience to errors as they are encoded as independent units.The encoder and decoder states are completely reset at a slice boundary.For example, intra-prediction is not carried out across sliceboundaries; slice boundaries are treated as image boundaries for thispurpose.

FIG. 14 schematically illustrates a set of possible (candidate)prediction directions. The full set of 34 candidate directions isavailable to a prediction unit of 8×8, 16×16 or 32×32 samples. Thespecial cases of prediction unit sizes of 4×4 and 64×64 samples have areduced set of candidate directions available to them (17 candidatedirections and 5 candidate directions respectively). The directions aredetermined by horizontal and vertical displacement relative to a currentblock position, but are encoded as prediction “modes”, a set of which isshown in FIG. 15. Note that the so-called DC mode represents a simplearithmetic mean of the surrounding upper and left-hand samples.

FIG. 16 schematically illustrates a zigzag scan, being a scan patternwhich may be applied by the scan unit 360. In FIG. 16, the pattern isshown for an example block of 8×8 transform coefficients, with the DCcoefficient being positioned at the top left position 840 of the block,and increasing horizontal and vertical spatial frequencies beingrepresented by coefficients at increasing distances downwards and to theright of the top-left position 840.

Note that in some embodiments, the coefficients may be scanned in areverse order (bottom right to top left using the ordering notation ofFIG. 16). Also it should be noted that in some embodiments, the scan maypass from left to right across a few (for example between one and three)uppermost horizontal rows, before carrying out a zig-zag of theremaining coefficients.

FIG. 17 schematically illustrates the operation of a CABAC entropyencoder.

In context adaptive encoding of this nature and according toembodiments, a bit of data may be encoded with respect to a probabilitymodel, or context, representing an expectation or prediction of howlikely it is that the data bit will be a one or a zero. To do this, aninput data bit is assigned a code value within a selected one of two (ormore generally, a plurality of) complementary sub-ranges of a range ofcode values, with the respective sizes of the sub-ranges (inembodiments, the respective proportions of the sub-ranges relative tothe set of code values) being defined by the context (which in turn isdefined by a context variable associated with or otherwise relevant tothat input value). A next step is to modify the overall range, which isto say, the set of code values, (for use in respect of a next input databit or value) in response to the assigned code value and the currentsize of the selected sub-range. If the modified range is then smallerthan a threshold representing a predetermined minimum size (for example,one half of an original range size) then it is increased in size, forexample by doubling (shifting left) the modified range, which doublingprocess can be carried out successively (more than once) if required,until the range has at least the predetermined minimum size. At thispoint, an output encoded data bit is generated to indicate that a (oreach, if more than one) doubling or size-increasing operation tookplace. A further step is to modify the context (that is, in embodiments,to modify the context variable) for use with or in respect of the nextinput data bit or value (or, in some embodiments, in respect of a nextgroup of data bits or values to be encoded). This may be carried out byusing the current context and the identity of the current “most probablesymbol” (either one or zero, whichever is indicated by the context tocurrently have a greater than 0.5 probability) as an index into alook-up table of new context values, or as inputs to an appropriatemathematical formula from which a new context variable may be derived.The modification of the context variable may, in embodiments, increasethe proportion of the set of code values in the sub-range which wasselected for the current data value.

The CABAC encoder operates in respect of binary data, that is to say,data represented by only the two symbols 0 and 1. The encoder makes useof a so-called context modelling process which selects a “context” orprobability model for subsequent data on the basis of previously encodeddata. The selection of the context is carried out in a deterministic wayso that the same determination, on the basis of previously decoded data,can be performed at the decoder without the need for further data(specifying the context) to be added to the encoded datastream passed tothe decoder.

Referring to FIG. 17, input data to be encoded may be passed to a binaryconverter 900 if it is not already in a binary form; if the data isalready in binary form, the converter 900 is bypassed (by a schematicswitch 910). In the present embodiments, conversion to a binary form isactually carried out by expressing the quantised transform coefficientdata as a series of binary “maps”, which will be described furtherbelow.

The binary data may then be handled by one of two processing paths, a“regular” and a “bypass” path (which are shown schematically as separatepaths but which, in embodiments discussed below, could in fact beimplemented by the same processing stages, just using slightly differentparameters). The bypass path employs a so-called bypass coder 920 whichdoes not necessarily make use of context modelling in the same form asthe regular path. In some examples of CABAC coding, this bypass path canbe selected if there is a need for particularly rapid processing of abatch of data, but in the present embodiments two features of so-called“bypass” data are noted: firstly, the bypass data is handled by theCABAC encoder (950, 960), just using a fixed context model representinga 50% probability; and secondly, the bypass data relates to certaincategories of data, one particular example being coefficient sign data.Otherwise, the regular path is selected by schematic switches 930, 940.This involves the data being processed by a context modeller 950followed by a coding engine 960.

The entropy encoder shown in FIG. 17 encodes a block of data (that is,for example, data corresponding to a block of coefficients relating to ablock of the residual image) as a single value if the block is formedentirely of zero-valued data. For each block that does not fall intothis category, that is to say a block that contains at least somenon-zero data, a “significance map” is prepared. The significance mapindicates whether, for each position in a block of data to be encoded,the corresponding coefficient in the block is non-zero. The significancemap data, being in binary form, is itself CABAC encoded. The use of thesignificance map assists with compression because no data needs to beencoded for a coefficient with a magnitude that the significance mapindicates to be zero. Also, the significance map can include a specialcode to indicate the final non-zero coefficient in the block, so thatall of the final high frequency/trailing zero coefficients can beomitted from the encoding. The significance map is followed, in theencoded bitstream, by data defining the values of the non-zerocoefficients specified by the significance map.

Further levels of map data are also prepared and are CABAC encoded. Anexample is a map which defines, as a binary value (1=yes, 0=no) whetherthe coefficient data at a map position which the significance map hasindicated to be “non-zero” actually has the value of “one”. Another mapspecifies whether the coefficient data at a map position which thesignificance map has indicated to be “non-zero” actually has the valueof “two”. A further map indicates, for those map positions where thesignificance map has indicated that the coefficient data is “non-zero”,whether the data has a value of “greater than two”. Another mapindicates, again for data identified as “non-zero”, the sign of the datavalue (using a predetermined binary notation such as 1 for +, 0 for −,or of course the other way around).

In embodiments, the significance map and other maps are generated fromthe quantised transform coefficients, for example by the scan unit 360,and is subjected to a zigzag scanning process (or a scanning processselected from zigzag, horizontal raster and vertical raster scanningaccording to the intra-prediction mode) before being subjected to CABACencoding.

In some embodiments, the HEVC CABAC entropy coder codes syntax elementsusing the following processes:

The location of the last significant coefficient (in scan order) in theTU is coded.

For each 4×4 coefficient group (groups are processed in reverse scanorder), a significant-coefficient-group flag is coded, indicatingwhether or not the group contains non-zero coefficients. This is notrequired for the group containing the last significant coefficient andis assumed to be 1 for the top-left group (containing the DCcoefficient). If the flag is 1, then the following syntax elementspertaining to the group are coded immediately following it:

Significance Map:

For each coefficient in the group, a flag is coded indicating whether ornot the coefficient is significant (has a non-zero value). No flag isnecessary for the coefficient indicated by the last-significantposition.

Greater-Than-One Map:

For up to eight coefficients with significance map value 1 (countedbackwards from the end of the group), this indicates whether themagnitude is greater than 1.

Greater-Than-Two Flag:

For up to one coefficient with greater-than-one map value 1 (the onenearest the end of the group), this indicates whether the magnitude isgreater than 2.

Sign Bits:

For all non-zero coefficients, sign bits are coded as equiprobable CABACbins, with the last sign bit (in reverse scan order) possibly beinginstead inferred from parity when sign bit hiding is used.

Escape Codes:

For any coefficient whose magnitude was not completely described by anearlier syntax element, the remainder is coded as an escape code.

In general terms, CABAC encoding involves predicting a context, or aprobability model, for a next bit to be encoded, based upon otherpreviously encoded data. If the next bit is the same as the bitidentified as “most likely” by the probability model, then the encodingof the information that “the next bit agrees with the probability model”can be encoded with great efficiency. It is less efficient to encodethat “the next bit does not agree with the probability model”, so thederivation of the context data is important to good operation of theencoder. The term “adaptive” means that the context or probabilitymodels are adapted, or varied during encoding, in an attempt to providea good match to the (as yet uncoded) next data.

Using a simple analogy, in the written English language, the letter “U”is relatively uncommon. But in a letter position immediately after theletter “Q”, it is very common indeed. So, a probability model might setthe probability of a “U” as a very low value, but if the current letteris a “Q”, the probability model for a “U” as the next letter could beset to a very high probability value.

CABAC encoding is used, in the present arrangements, for at least thesignificance map and the maps indicating whether the non-zero values areone or two. Bypass processing—which in these embodiments is identical toCABAC encoding but for the fact that the probability model is fixed atan equal (0.5:0.5) probability distribution of 1s and 0s, is used for atleast the sign data and the map indicating whether a value is >2. Forthose data positions identified as >2, a separate so-called escape dataencoding can be used to encode the actual value of the data. This mayinclude a Golomb-Rice encoding technique.

The CABAC context modelling and encoding process is described in moredetail in WD4: Working Draft 4 of High-Efficiency Video Coding,JCTVC-F803_d5, Draft ISO/IEC 23008-HEVC; 201x(E) 2011-10-28.

The CABAC process will now be described in a little more detail.

CABAC, at least as far as it is used in the proposed HEVC system,involves deriving a “context” or probability model in respect of a nextbit to be encoded. The context, defined by a context variable or CV,then influences how the bit is encoded. In general terms, if the nextbit is the same as the value which the CV defines as the expected moreprobable value, then there are advantages in terms of reducing thenumber of output bits needed to define that data bit.

The encoding process involves mapping a bit to be encoded onto aposition within a range of code values. The range of code values isshown schematically in FIG. 18A as a series of adjacent integer numbersextending from a lower limit, m_Low, to an upper limit, m_high. Thedifference between these two limits is m_range, wherem_range=m_high−m_Low. By various techniques to be described below, in abasic CABAC system m_range is constrained to lie between 128 and 254; inanother embodiment using a larger number of bits to represent m_range,m_range may lie between 256 and 510. m_Low can be any value. It canstart at (say) zero, but can vary as part of the encoding process to bedescribed.

The range of code values, m_range, is divided into two sub-ranges, by aboundary 1100 defined with respect to the context variable as:

boundary=m_Low+(CV*m_range)

So, the context variable divides the total range into two complementarysub-ranges or sub-portions of the set of code values, the proportions ofthe set assigned to each sub-range being determined by the variable CV,one sub-range being associated with a value (of a next data bit) ofzero, and the other being associated with a value (of the next data bit)of one. The division of the range represents the probabilities assumedby the generation of the CV of the two bit values for the next bit to beencoded. So, if the sub-range associated with the value zero is lessthan half of the total range, this signifies that a zero is consideredless probable, as the next symbol, than a one.

Various different possibilities exist for defining which way round thesub-ranges apply to the possible data bit values. In one example, alower region of the range (that is, from m_Low to the boundary) is byconvention defined as being associated with the data bit value of zero.

If more than one bit was being encoded at a single operation, more thantwo sub-ranges could be provided so as to give a sub-range correspondingto each possible value of the input data to be encoded.

The encoder and decoder maintain a record of which data bit value is theless probable (often termed the “least probable symbol” or LPS). The CVrefers to the LPS, so the CV always represents a value of between 0 and0.5.

A next bit is now mapped to the range m_range, as divided by theboundary. This is carried out deterministically at both the encoder andthe decoder using a technique to be described in more detail below. Ifthe next bit is a 0, a particular code value, representing a positionwithin the sub-range from m_Low to the boundary, is assigned to thatbit. If the next bit is a 1, a particular code value in the sub-rangefrom the boundary 1100 to m_high is assigned to that bit. Thisrepresents an example of a technique by which embodiments may select oneof the plurality of sub-ranges of the set of code values according tothe value of the current input data bit, and also an example of atechnique by which embodiments may assign the current input data valueto a code value within the selected sub-range.

The lower limit m_Low and the range m_range are then redefined so as tomodify the set of code values in dependence upon the assigned code value(for example, which sub-range the assigned code value fell into) and thesize of the selected sub-range. If the just-encoded bit is a zero, thenm_Low is unchanged but m_range is redefined to equal m_range*CV. If thejust-encoded bit is a one then m_Low is moved to the boundary position(m_Low+(CV*m_range)) and m_range is redefined as the difference betweenthe boundary and m_high (that is, (1−CV)*m_range).

After such modification, a detection is made as to whether the set ofcode values is less than a predetermined minimum size (for example, ism_range at least 128).

These alternatives are illustrated schematically in FIGS. 18B and 18C.

In FIG. 18B, the data bit was a 1 and so m_Low was moved up to theprevious boundary position. This provides a revised or modified set ofcode values for use in a next bit encoding sequence. Note that in someembodiments, the value of CV is changed for the next bit encoding, atleast in part on the value of the just-encoded bit. This is why thetechnique refers to “adaptive” contexts. The revised value of CV is usedto generate a new boundary 1100′.

In FIG. 18C, a value of 0 was encoded, and so m_Low remained unchangedbut m_high was moved to the previous boundary position. The valuem_range is redefined or modified as the new values of m_high−m_Low.

In this example, this has resulted in m_range falling below its minimumallowable value (such as 128). When this outcome is detected, the valuem_range is renormalized or size-increased—which in the presentembodiments is represented by m_range being doubled, that is, shiftedleft by one bit, as many times as are necessary to restore m_range tothe required range of 128 to 256. An example of this is illustrated inFIG. 18D, which represents the range of FIG. 18C, doubled so as tocomply with the required constraints. A new boundary 1100″ is derivedfrom the next value of CV and the revised m_range. Note that m_Low issimilarly renormalized or size-increased whenever m_range isrenormalized. This is done in order to maintain the same ratio betweenm_Low and m_range.

Whenever the range has to be multiplied by two in this way, an outputencoded data bit is generated, one for each renormalizing stage.

In this way, the interval m_range and the lower limit m_Low aresuccessively modified and renormalized in dependence upon the adaptationof the CV values (which can be reproduced at the decoder) and theencoded bit stream. After a series of bits has been encoded, theresulting interval and the number of renormalizing stage uniquelydefines the encoded bitstream. A decoder which knows such a finalinterval would in principle be able to reconstruct the encoded data.However, the underlying mathematics demonstrate that it is not actuallynecessary to define the interval to the decoder, but just to define oneposition within that interval. This is the purpose of the assigned codevalue, which is maintained at the encoder and passed to the decoder atthe termination of encoding the data.

To give a simplified example, consider a probability space divided into100 intervals. In this case, m_Low would represent the bottom of aprobability space, and 0 and m_Range would represent its size, (100).Assume for the purposes of this example that the context variable is setat 0.5 (as it is in respect of the bypass path), so the probabilityspace is to be used to encode binary bits with fixed probability of 50%.However, the same principles apply if adaptive values of the contextvariable are used, such that the same adaptation process takes place atthe encoder and the decoder.

For the first bit, each symbol (0 or 1) would have a symbol range of 50,with the input symbol 0 being assigned (say) the values 0 to 49inclusive and the input symbol 1 being assigned (say) the values 50 to99 inclusive. If a 1 is to be the first bit to be encoded, then thefinal value of the stream must lie in the 50 to 99 range, hence m_Lowbecomes 50 and m_Range becomes 50.

To encode the second bit, the range is further subdivided into symbolranges of 25, with an input symbol of 0 taking the values 50 to 74 andan input symbol of 1 taking the values 75 to 99. As can be seen,whichever symbol is encoded as the second bit, the final value is stillbetween 50 and 99, preserving the first bit, but now a second bit hasbeen encoded into the same number. Likewise if the second bit were touse a different probability model to the first, it still wouldn't affectthe encoding of the first bit because the range being subdivided isstill 50 to 99.

This process continues at the encoder side for each input bit,renormalizing (for example, doubling) m_Range and m_Low wherevernecessary, for example in response to m_Range dropping below 50. By theend of the encoding process (when the stream is terminated) the finalvalue has been written to the stream.

At the decoder side, the final value is read from the stream (hence thename m_Value)—say for example, the value is 68. The decoder applies thesame symbol range split to the initial probability space and comparesits value to see which symbol range it lies in. Seeing that 68 lies inthe 50 to 99 range, it decodes a 1 as the symbol for its first bit.Applying the second range split in the same way as the encoder, it seesthat 68 lies in the 50 to 74 range and decodes 0 as the second bit, andso on.

In an actual implementation, the decoder may avoid having to maintainm_Low as the encoder does by subtracting the bottom value of eachdecoded symbol's range from m_Value (in this case, 50 is subtracted fromm_Value to leave 18). The symbol ranges are then always subdivisions ofthe 0 to (m_range−1) range (so the 50 to 74 range becomes 0 to 24).

It is important to note that, if only two bits were to be encoded thisway, the encoder could pick any final value within the 50 to 74 rangeand they would all decode to the same two bits “10” (one followed byzero). More precision is only needed if further bits are to be encodedand in practice, the HEVC encoder would always pick 50, the bottom ofthe range. The embodiments discussed in the present application seek tomake use of that unused range by finding certain bits that, when setappropriately, guarantee the final value will decode correctlyregardless of what the values of the remaining bits are, freeing thoseremaining bits for carrying other information. For example, in thesample encode given above, if the first digit were set to 6 (or 5), thenthe final value would always be in the 50 to 74 range regardless of thevalue of the second digit; hence the second digit can be used to carryother information.

As can be seen, an endless stream of bits can be coded using the sameprobability range (given infinite-precision fractions) by repeatedlysubdividing it. In practice however, infinite precision is impossibleand non-integer numbers are to be avoided. For this purpose,renormalisation is used. If the 50 to 74 range were to be used to encodea third bit, the symbol ranges would ordinarily have to be 12.5intervals each, but instead, m_Range and m_Low can be doubled (orotherwise multiplied by a common factor) to 50 and 100 respectively andthe symbol ranges would now be subdivisions of the range of 100 to 149i.e. 25 intervals each. This operation is equivalent to retroactivelydoubling the size of the initial probability space from 100 to 200.Since the decoder maintains the same m_Range, it can applyrenormalisation at the same times as the encoder.

The context variable CV is defined as having (in an example embodiment)64 possible states which successively indicate different probabilitiesfrom a lower limit (such as 1%) at CV=63 through to a 50% probability atCV=0.

In an adaptive system CV is changed or modified from one bit to the nextaccording to various known factors, which may be different depending onthe block size of data to be encoded. In some instances, the state ofneighbouring and previous image blocks may be taken into account. So,the techniques described here are examples of modifying the contextvariable, for use in respect of a next input data value, so as toincrease the proportion of the set of code values in the sub-range whichwas selected for the current data value.

The functions of selecting a sub-range, assigning the current bit to acode value, modifying the set of code values, detecting whether the setis less than a minimum size, and modifying the context variable may allbe carried out by the context modeller 950 and the coding engine 960,acting together. So, although they are drawn as separate items in FIG.17 for clarity of the explanation, they act together to provide acontext modelling and coding function. However, for further clarity,reference is made to FIG. 19 which illustrates these operations andfunctionalities in more detail.

The assigned code value is generated from a table which defines, foreach possible value of CV and each possible value of bits 6 and 7 ofm_range (noting that bit 8 of m_range is always 1 because of theconstraint on the size of m_range), a position or group of positions atwhich a newly encoded bit should be allocated a code value in therelevant sub-range.

FIG. 19 schematically illustrates a CABAC encoder using the techniquesdescribed above.

The CV is initiated (in the case of the first CV) or modified (in thecase of subsequent CVs) by a CV derivation unit 1120. A code generator1130 divides the current m_range according to CV, selects a sub-rangeand generates an assigned data code within the appropriate sub_range,for example using the table mentioned above. A range reset unit 1140resets m_range to that of the selected sub-range so as to modify the setof code values as described above. A normaliser 1150 detects whether theresulting value of m_range is below the minimum allowable value and, ifnecessary, renormalises the m_range one or more times, outputting anoutput encoded data bit for each such renormalisation operation. Asmentioned, at the end of the process, the assigned code value is alsooutput.

In a decoder, shown schematically in FIG. 20, the CV is initiated (inthe case of the first CV) or modified (in the case of subsequent CVs) bya CV derivation unit 1220 which operates in the same way as the unit1120 in the encoder. A code application unit 1230 divides the currentm_range according to CV and detects in which sub-range the data codelies. A range reset unit 1240 resets m_range to that of the selectedsub-range so as to modify the set of code values in dependence upon theassigned code value and the size of the selected sub-range. Ifnecessary, a normaliser 1250 renormalises the m_range in response to areceived data bit.

Embodiments provide a technique to terminate a CABAC stream. Theembodiments will be described in the context of an example system inwhich the code value range has a maximum value of 512 (instead of 128 asdescribed above) and so is constrained to lie in the upper half of thisrange, that is, from 256 to 510.

The technique can produce a loss of on average 1.5 bits (which is tosay, a much smaller loss than previous stream termination techniquescaused). A second alternative method is also presented which can producean average loss of 1 bit. Applications of these techniques have beensuggested to include termination of the CABAC stream prior to sendingIPCM (non-frequency separated) data, and termination of the stream forrow-per-slice. The technique is based on the recognition that the CABACvariable can be set to any value within the correct range at the time oftermination. So the CABAC variable is set to a value which has a numberof trailing (least significant bit) zeros, so that when the value isflushed to the data stream, the zeros can effectively be ignored.

In current techniques, terminating a CABAC stream causes 8 bits to beflushed to the data stream (that is, lost or wasted) The technique isillustrated with an example where intra frames are terminated after eachLCU or image slice (that is, after encoding a group of data valuesrepresenting data values relating to a particular respective imagesub-area), allowing the coefficient bypass data (sign bits/escape codes)to be placed into the bit-stream in a raw format.

A process to terminate the CABAC stream is applied at the end of eachslice and prior to IPCM data. In embodiments this process assumes (forthe purposes of this discussion) that the probability that the stream isto be terminated is fixed at on average 0.54%. (When a data value (1 or0) is encoded, the current m_range is subdivided into two symbol ranges,representing the probability of 1 or 0 respectively. For the special“end-of-stream flag” value, the symbol range for 1 is always 2. Hencethe probability of the data value being 1 is dependent on the value ofthe current m_range. In some embodiments, as discussed above, m_rangemay vary between 256 and 510, so the termination probability thereforevaries between 2/510=0.3922% and 2/256=0.7813%).

For the encoder, this process is:

-   -   if the stream is not to be terminated, the CABAC range m_range        is decremented by 2, and the CABAC engine is renormalized by 1        place if required (which is to say that m_Low and m_range are        renormalized); processing on the current CABAC stream continues.    -   if the stream is to be terminated, the CABAC ‘m_Low’ is        incremented by ‘the range less 2’, the range is set to 2, and        the CABAC engine is renormalized by 7 places, followed by        outputting a further binary ‘1’. This process is equivalent to a        renormalization of 8 places, where the value being renormalized        has been forced to be an odd number.

There may be occasions where the above process is not ideal—i.e. wherethe probability of the stream is variable, or fixed at a higherpercentage, or even a certainty (probability of 1).

Embodiments can provide a method whereby the CABAC stream can beimmediately terminated with just 2 renormalizations, with a loss of (onaverage) 1.5 bits and negligible impact on the decoder and encodercomplexity. An alternative method is also indicated that can reduce theoverhead to just 1 bit, but at the expense of an increase in CABACdecoder complexity. Both methods can then be used in conjunction with astandard adaptive context variable if there is a variable probability oftermination, or in conjunction with a fixed percentage mechanism (akinto a non-adaptive context variable).

Note that as discussed above, m_Low and m_Range are renormalisedtogether.

1 Algorithm

1.1 Method

The steps of the encoder are as follows:

m_Low=(m_Low+128)&~127 {or m_Low=(m_Low+127)&~127} Force 2 stages ofrenormalization of m_Low and call test_write_out( ) [write the value tothe stream] Prior to encoding next CABAC stream, set m_Range=510,m_Low=0.Notation: & is an A/VD operation, and signifies the binary inverse (so˜127 is the binary inverse of the binary value corresponding to decimal127, so that an A/VD operation with the binary inverse of a number suchas decimal 127 (which has a plurality of least significant bits or LSBsequal to 1) is equivalent to setting that number of LSBs of theresulting value to zero). The function test_write_out ( ) checks whetherany bits at the top (MSB end) of m_Low are eligible to be sent to theoutput stream, writing them if so. In the context of the pseudo-codeshown above, the new bits created by the “forced renormalisation” willbe written by this operation.

The steps of the decoder are as follows:

Rewind input stream by 7 bits (i.e. move read position back by 7 bits).Prior to decoding next CABAC stream, set m_Range=0, and read m_valuefrom bit-stream.

This method has a low processing impact on the decoder and encoder.

In respect of m_Low, note that the encoder generates a stream byrepeatedly adding to m_Low. The decoder reads that stream by startingwith the encoder's final result and repeatedly subtracting from it. Thedecoder calls the bits read from the stream “m_uiValue” (or m_value inthe notation of this description) rather than m_Low and it is this thatshould be read from the bit stream. This is relevant in this case wheresome embodiments require that the decoder maintain m_Low as well asm_uiValue so it knows what the encoder is doing. In that case, m_Low isgenerated at the decoder in exactly the same way as the encoder's m_Low.

Alternative Method

This method increases the complexity of current decoders as it requiresthat the decoder maintains m_Low. If maintenance of m_Low is required byother proposals, then this additional complexity is again minimal.

The steps of the encoder are as follows:

Let test256=(m_Low+255)&~255 If (test256+256 < m_Low+m_Range)m_Low=m_test256 Force 1 stage of renormalization of m_Low and calltest_write_out( ). Else (as before) m_Low=(m_Low+128)&~127 { orm_Low=(m_Low+127)&~127 } Force 2 stages of renormalization of m_Low andcall test_write_out( ). Prior to encoding next CABAC stream, setm_Range=510, m_Low=0.The steps of the decoder are as follows:

Let test256=(m_Low+255)&~255 If (test256+256 < m_Low+m_Range) Rewindstream by 8 bits Else (as before) Rewind stream by 7 bits Prior todecoding next CABAC stream, set m_Range=0, set m_Low = 0 and readm_value from bit-stream. Theory

For the CABAC encoder, the data written to the stream (or buffered) isconcatenated with m_Low is an n-bit value low indicating the lowestvalue that the final output can be. The highest value, high, is the sumof low and m_Range, a variable maintained by the encoder to be withinthe range 256 (indusive) to 511 (exclusive). At the end of the stream,any value between low (inclusive) and high (exclusive) can be selectedas the final output value, without affecting the decode. If the decodecould occur without being dependent on the n LSBs of the value, then then LSBs could be replaced with data from the next section of thebit-stream.

Let v be a value between low and high where n LSBs are 0, and where ifthe last n LSBs were 1, the resulting value V would still be less thanhigh. Since “high-low” is at least 256, then there will always be avalue v between low and high that has at least 7 LSBs that are 0. i.e.the value v is the first value between low and high that is divisible by128 without a remainder.

The simplest manner to achieve this is a standard power-of-2 alignmentroutine, namely:

v=(low+127)&˜127

-   -   However, since range is at least 256, then:

v=(low+128)&˜127

-   -   is also sufficient (and results in a slightly smaller encoder).

For the current part of the bit-stream, the encoder would output thevalue ‘v’, except for the bottom 7 bits, this is achieved byrenormalizing m_Low by 2 places. At the end of the bit-stream, thedecoder would have read 7 bits from the next section of the bit stream,and therefore would have to ‘rewind’ the bit-stream by 7 bits.

There are cases where the bottom 8 bits are not required to fully decodethe stream, with the simplest illustration being where “m_Low=0”, andthese are explored by the alternative algorithm. In this alternativealgorithm, the value v between low and high with 8 LSBs of 0 iscalculated, and then a test is applied to check if there is acorresponding value V. The decision process requires tests on low andhigh, and since the decoder must also make the same decision, thedecoder would need to track m_Low.

In both versions of the encoder algorithm, there is a choice for the7-bit path, which will result in a different bit-stream, but will bedecodable by the same decoder.

With reference to FIG. 19 described above, the units 1120 and 1130represent embodiments of a selector to select one of a plurality ofcomplementary sub-ranges of a set of code values, and a data assigningunit to assign the current input value to a code value. he unit 1140represents an embodiment of a data modifying unit. The unit 1150represents an embodiment of a detector for detecting whether the set ofcode values is less than a minimum size and to carry out the otherfunctions of that detector accordingly. The unit 1150 also represents anembodiment of a data terminator by carrying out the data terminationfunctionality described above and that described below, and inparticular by making the decision as to when to terminate the stream.

With reference to FIG. 20 described above, the units 1220, 1230, 1240and 1250 collectively represent embodiments of a pointer controller anda setting unit, in that they are operable to carry out the functionalitydescribed above in respect of these units.

Applications

Possible Applications for this Include:

1. Termination for the last encoded LCU for a slice, especially in a‘row-per-slice’ style configuration, where the probability may besignificantly higher than 0.54%; in this arrangement, embodiments canprovide a data encoding method for encoding successive input data valuesrepresenting video data, the method comprising the steps of: selectingone of a plurality of complementary sub-ranges of a set of code valuesaccording to the value of a current input data value, the proportions ofthe sub-ranges relative to the set of code values being defined by acontext variable associated with that input data value; assigning thecurrent input data value to a code value within the selected sub-range;modifying the set of code values in dependence upon the assigned codevalue and the size of the selected sub-range; detecting whether the setof code values is less than a predetermined minimum size and if so,successively increasing the size of the set of code values until it hasat least the predetermined minimum size; and outputting an encoded databit in response to each such size-increasing operation; modifying thecontext variable, for use in respect of a next input data bit or value,so as to increase the proportion of the set of code values in thesub-range which was selected for the current data value; and afterencoding a group of input data values corresponding to a set of blocksof video data within a slice of the video data which is encoded withoutreference to other video data, terminating the output data by: setting avalue defining an end of the set of code values to a value having aplurality of least significant bits equal to zero; increasing the sizeof the set of code values; and writing the value defining the end of theset of code values to the output data.

2. Termination for the last possible LCU for a slice, as terminationafter the last possible LCU of a slice is a certainty; in thisarrangement, embodiments can provide a data encoding method for encodingsuccessive input data values representing video data, the methodcomprising the steps of: selecting one of a plurality of complementarysub-ranges of a set of code values according to the value of a currentinput data value, the proportions of the sub-ranges relative to the setof code values being defined by a context variable associated with thatinput data value; assigning the current input data value to a code valuewithin the selected sub-range; modifying the set of code values independence upon the assigned code value and the size of the selectedsub-range; detecting whether the set of code values is less than apredetermined minimum size and if so, successively increasing the sizeof the set of code values until it has at least the predeterminedminimum size; and outputting an encoded data bit in response to eachsuch size-increasing operation; modifying the context variable, for usein respect of a next input data bit or value, so as to increase theproportion of the set of code values in the sub-range which was selectedfor the current data value; and after encoding a group of input datavalues representing the whole of a slice of video data which is encodedwithout reference to other video data, terminating the output data by:setting a value defining an end of the set of code values to a valuehaving a plurality of least significant bits equal to zero; increasingthe size of the set of code values; and writing the value defining theend of the set of code values to the output data.

3. Termination prior to IPCM data, possibly in conjunction with acontext variable; in this arrangement, embodiments can provide a dataencoding method for encoding successive input data values representingfrequency separated video data, the method comprising the steps of:selecting one of a plurality of complementary sub-ranges of a set ofcode values according to the value of a current input data value, theproportions of the sub-ranges relative to the set of code values beingdefined by a context variable associated with that input data value;assigning the current input data value to a code value within theselected sub-range; modifying the set of code values in dependence uponthe assigned code value and the size of the selected sub-range;detecting whether the set of code values is less than a predeterminedminimum size and if so, successively increasing the size of the set ofcode values until it has at least the predetermined minimum size; andoutputting an encoded data bit in response to each such size-increasingoperation; modifying the context variable, for use in respect of a nextinput data bit or value, so as to increase the proportion of the set ofcode values in the sub-range which was selected for the current datavalue; and after encoding a group of input data values such that a nextgroup of data values to be encoded represent non-frequency-separatedvideo data, terminating the output data by: setting a value defining anend of the set of code values to a value having a plurality of leastsignificant bits equal to zero; increasing the size of the set of codevalues; and writing the value defining the end of the set of code valuesto the output data.

4. Termination of the stream to prevent the “bits outstanding” mechanismgetting too long; in this arrangement, embodiments can provide a dataencoding method for encoding successive input data values, the methodcomprising the steps of: selecting one of a plurality of complementarysub-ranges of a set of code values according to the value of a currentinput data value, the proportions of the sub-ranges relative to the setof code values being defined by a context variable associated with thatinput data value; assigning the current input data value to a code valuewithin the selected sub-range; modifying the set of code values independence upon the assigned code value and the size of the selectedsub-range; detecting whether the set of code values is less than apredetermined minimum size and if so, successively increasing the sizeof the set of code values until it has at least the predeterminedminimum size; and outputting an encoded data bit in response to eachsuch size-increasing operation; modifying the context variable, for usein respect of a next input data bit or value, so as to increase theproportion of the set of code values in the sub-range which was selectedfor the current data value; detecting whether a set of data values to beencoded by a different encoding technique exceeds a predetermined size,and if so, terminating the output data by: setting a value defining anend of the set of code values to a value having a plurality of leastsignificant bits equal to zero; increasing the size of the set of codevalues; and writing the value defining the end of the set of code valuesto the output data.

The following part of the description is concerned with extending theoperation of encoders and decoders such as those described above tooperation at higher video resolutions and correspondingly low (includingnegative) QPs. Low operating QPs may be needed if the codec is to trulysupport high bit depths. Possible sources of errors that may be causedby internal accuracy limitations present in encoders and decoders suchas those defined by HEVC will be discussed. Some changes to thoseaccuracies can mitigate the errors and thereby extend the operatingrange of HEVC. In addition, changes to the entropy coding are presented.

At the time of filing the present application, HEVC Version 1 describesan 8 and 10 bit codec; Version 2 is to include 12 and 14 bit operation.Although the test or demonstration software has been written to allowinput data bit depths up to 14, the ability of the codec to code 14 bitsdoes not necessarily correspond to the way that the codec handles 8 or10 bit resolution data. In some instances the internal processing mayintroduce noise, which can lead to an effective loss of resolution. Forexample, if the peak signal to noise ratio (PSNR) for 14-bit input datais so low that the least-significant two bits are effectively reduced tonoise, then the codec is effectively only operating at 12-bitresolution. It is therefore appropriate to aim towards a system havinginternal operating functions which allow higher resolution input data tobe used (for example, 12 or 14 bit resolution input data) withoutintroducing so much noise, errors or other artefacts as to reduce theeffective (useful) resolution of the output data by a significantamount.

The term “bit depth” and the variable bitDepth are used here to indicatethe resolution of the input data and/or (according to the textualcontext) of the data processing carried out within the codec (the latterbeing also known as “internal bit depth” using HEVC softwaredemonstration model terminology). For example, for 14-bit dataprocessing, bitDepth=14.

In the context of the 8 and 10 bit codec, quantisation parameters (QPs)in the positive range (QP>0) are discussed. However, for each additionalbit (over 8 bits) in the resolution of the input data, the minimumallowable QP (minQP) can be 6 lower than 0, or in other words:

min QP=−6*(bitDepth−8)

The variable “PSNR”, or peak SNR, is defined as a function ofmean-square error (MSE) and bit depth:

PSNR=10*log₁₀(((2^(bitDepth))−1)²/MSE)

As can be seen in FIG. 23, to be discussed below, no matter what valueof the internal processing bit depth of the example codecimplementation, the general trend is that the PSNR curves peak at around90 dB; for more negative QPs (than the QP corresponding to the peak ofthe PSNR curve), the PSNR performance actually degrades.

Using the equation for PSNR, the following table of PSNRs for given bitdepths and MSE can be derived:

Bit depth MSE 8 9 10 11 12 13 14 15 16 0.25 54.2 60.2 66.2 72.2 78.384.3 90.3 96.3 102.4 0.5 51.1 57.2 63.2 69.2 75.3 81.3 87.3 93.3 99.3 148.1 54.2 60.2 66.2 72.2 78.3 84.3 90.3 96.3 1.5 46.4 52.4 58.4 64.570.5 76.5 82.5 88.5 94.6 2 45.1 51.2 57.2 63.2 69.2 75.3 81.3 87.3 93.34 42.1 48.1 54.2 60.2 66.2 72.2 78.3 84.3 90.3 5.5 40.7 46.8 52.8 58.864.8 70.9 76.9 82.9 88.9 8 39.1 45.1 51.2 57.2 63.2 69.2 75.3 81.3 87.316 36.1 42.1 48.2 54.2 60.2 66.2 72.2 78.3 84.3 21.5 34.8 40.8 46.9 52.958.9 64.9 71.0 77.0 83.0 32 33.1 39.1 45.1 51.2 57.2 63.2 69.2 75.3 81.364 30.1 36.1 42.1 48.2 54.2 60.2 66.2 72.2 78.3

If a 14-bit codec is only able to achieve a PSNR of 72.2 dB, then eachoutput value is only accurate to within the range of ±4 of thecorresponding original value. The two least significant bits aretherefore effectively noise, so the codec is really equivalent to a12-bit codec with two additional random bits added at the output (It isimportant to note that this analysis is based upon averages, and thatactually in some parts of the picture, better or worse quality than thisaverage may be achieved).

Extending this argument, when comparing PSNRs in this purely numericalfashion, it could be thought that the best system would therefore infact be an 8-bit system with lossless encoding, achieving an infinitePSNR (MSE=0). However, this does not take into account the loss ininitially rounding or truncating the video from n bits (where n isoriginally higher than 8) down to 8 bits. This approach can begeneralised according to the following examples:

-   -   If a lossless (n−1)-bit system were available to encode the        n-bit data, then at the output, the n-bit MSE observed would be        (0+12)/2=0.5.    -   If a lossless (n−2)-bit system were available to encode the        n-bit data, then at the output, the n-bit MSE observed would be        (0+1²+2²+1²)/4=1.5.    -   If a lossless (n−3)-bit system were available to encode the        n-bit data, then at the output, the n-bit MSE observed would be        (0+1²+2²+3²+4²+3²+2²+1²)/8=5.5.    -   If a lossless (n−4)-bit system were available to encode the        n-bit data, then at the output, the n-bit MSE observed would be:        (0+1²+2²+3²+4²+5²+6²+7²+8²+7²+6²+5²+4²+3²+2²+1²)/16=21.5.

Therefore, returning to the specific example, if the 14-bit system doesnot achieve an MSE of 21.5 or less (equivalent to 71.0 dB) and if thebit rate of a lossless 10-bit system were similar, then numericallyspeaking, only 10 bits are effectively being coded.

Consider a lossy, low bit depth (n-r)-bit system with MSE of ‘m’. Ifthis system is used to code higher bit depth n-bit data, its MSE willtherefore be given by (2^(r))²m.

For example, for a lossy (n−1)-bit system, MSE in an n-bit system wouldbe 4m; for a lossy (n−2)-bit system, MSE in an n-bit system would be16m; for a lossy (n−3)-bit system, MSE in an n-bit system would be 64m;and for a lossy (n−4)-bit system, MSE in an n-bit system would be 256m.

Therefore for the case where lossy lower bit depth systems encode higher(n-bit) bit depth data, their loss is generally the main contributor forthe MSE observed in the n-bit domain, so simple PSNR figures can be usedas straight comparisons of quality.

An implementation of a HEVC encoder (at the time of filing theapplication) peaks at 90 dB (as shown in FIG. 23); this may beconsidered suitable for encoding 11-bit data, but at this operatingpoint, the matter of whether any further improvement can be gained willbe discussed below.

First, the potential sources of error will be discussed.

The core HEVC system (version 1) has been designed for 8 and 10 bitoperation. As the number of bits increases, the internal accuracies ofparts of the system may become relevant as potential sources of error,noise or artefacts leading to an effective loss of overall resolution.

A simplified schematic diagram illustrating a flow of data through anencoder of the types discussed above, such as a HEVC encoder, is shownin FIG. 21. A purpose of summarising the process in the form shown inFIG. 21 is to indicate the potential limitations on operating resolutionwithin the system. Note that for this reason, not all of the encoderfunctionality is shown in FIG. 21. Note also that FIG. 21 provides anexample of an apparatus for encoding input data values of a data set(which may be video data values). Further, note that (as discussedabove) techniques used in a forward encoding path such as that shown inFIG. 21 may also be used in the complementary reverse decoding path ofthe encoder and may also be used in a forward decoding path of adecoder.

Input data 1300 of a certain bit depth is supplied to a prediction stage1310 which performs either intra- or inter-prediction and subtracts thepredicted version from the actual input image, generating residual data1320 of a certain bit depth. So, the stage 1300 generally corresponds tothe items 320 and 310 of FIG. 5.

The residual data 1320 is frequency-transformed by a transform stage1330 which involves multiple stages of transform processing (labelled asstage 1 and stage 2), corresponding to left and right matricmultiplications in the 2D transform equation, and operates according toone or more sets of transform matrices 1340 (the transforms can beimplemented by a matrix multiplication process) having a certainresolution. A maximum dynamic range 1350 of the transform process,referred to as MAX_TR_DYNAMIC_RANGE, applies to the calculations used inthis process. The output of the transform stage is a set of transformcoefficients 1360 according to the MAX_TR_DYNAMIC_RANGE. The transformstage 1330 corresponds generally to the transform unit 340 of FIG. 5.

The coefficients 1360 are then passed to a quantising stage 1370generally corresponding to the quantiser 350 of FIG. 5. The quantisingstage may use a multiply-shift mechanism under the control ofquantisation coefficients and scaling lists 1380, including dipping tothe maximum dynamic range ENTROPY_CODING_DYNAMIC_RANGE (which is, inembodiments, the same as MAX_TR_DYNAMIC_RANGE). The output of thequantising stage is a set 1390 of quantised coefficients according toENTROPY_CODING_DYNAMIC_RANGE which is then (in the full encoder, notshown here) passed to an entropy encoding stage such as that representedby the scan unit 360 and entropy encoder 370 of FIG. 5.

Using the notation introduced in respect of FIG. 21, the main sources ofcalculation noise, ignoring (for the purposes of this discussion) noiseshaping caused by the various predictions and the RQT (residualquad-tree) and RDOQ (rate distortion optimized quantisation) decisionprocesses, in HEVC are discussed below:

Transform Matrix Coefficient Values

Ideally, the inverse transform applied to transformed coefficients willreproduce the original input values. However, this is limited by theinteger nature of the calculations. In HEVC, the transform matrixcoefficients have 6 fractional bits (i.e. they have an inherentleft-shift of 6).

Shifting Results to MAX_TR_DYNAMIC_RANGE after Each Stage of theTransform

The forward transform will result in values that are bitDepth+log₂(size)bits in size. After the first stage of the transform, the coefficients'width in bits should be at least bitDepth+log₂(size) (though additionalbits will help maintain more accuracy). However, in HEVC, theseintermediates are shifted in the forward (encoder only) transform sothat they never exceed MAX_TR_DYNAMIC_RANGE; similarly for the secondstage. In the inverse transform, the values at the output of each stageare clipped to MAX_TR_DYNAMIC RANGE.

If MAX_TR_DYNAMIC_RANGE is less than bitDepth+log₂(size), then thevalues out of the forward transform will actually be shifted left(instead of right) in the quantising stage, and then clipped to 15-bit(ENTROPY_CODING_DYNAMIC_RANGE). Actually, ifENTROPY_CODING_DYNAMIC_RANGE is less than bitDepth+log 2(size)+1,clipping will occur when QP is less than (4−(6*(bitDepth−8))).

In HEVC, MAX_TR_DYNAMIC_RANGE (and ENTROPY_CODING_DYNAMIC_RANGE of 15 isused for up to 10 bit operation, although coefficients in 32×32 blocksmay be clipped for QP <−8. In addition, the lack of headroom forinternal accuracy may also introduce errors for low QPs.

Noise Added During Quantisation

Although the quantiser and inverse quantiser of an encoder and decoderwill add noise when quantising, additional noise may be inadvertentlyadded when the scaling lists are applied, and because the quantisationcoefficients defined in the arrays ‘quantScales’ and ‘invQuantScales’are not necessarily perfect reciprocals.

The effects of transform matrix precision and MAX_TR_DYNAMIC_RANGE arediscussed below.

Empirical data was obtained by analysis (under the so-called intracoding profile) of the coding of five video sequences from the so-calledSVT test set (1920×1080 50p at 16 bit, scaled down from 4K video). Ofthese sequences, only the first 150 frames have been used in the tests.A sixth sequence, referred to as Traffic_RGB (2560×1600 30p at 12 bit)is defined by the standard Range Extension test conditions applicable toHEVC at the time of filing the present application.

In the empirical tests, if the file (input data) bit depth was less thanthe internal bit depth being tested (the codec's input bit depth), thenthe samples were padded (with the LSBs set to 0); if the file bit depthwas more than the internal bit depth, the samples were scaled androunded.

In the discussion below, bitDepth is used to describe the internal bitdepth rather than the bit depth of the input data. Systems with internalbit depth (bitDepth) up to 16 are considered.

FIG. 22 is a graph of bit rate against quantisation parameter (QP) whichschematically illustrates the empirical performance of the encodersystem of FIG. 21 at a number of internal bit depths. FIG. 23 is a graphof PSNR for the green channel (on the basis that it is easier to obtainempirical data for one channel, and green is the channel whichcontributes the most to the viewer's perception of the output video),against QP. The graphs of FIG. 22 are formed from a composite of datafor 16-bit (QP −48 to −26), 14-bit (QP −24 to −14), 12-bit (QP −12 to−2), 10-bit (QP 0 to 10) and 8-bit (QP 12 to 22) processing. Verticallines 1400 schematically indicate the points at which the bit depthchanges. The multiple curves in FIG. 22 correspond to results obtainedwith different respective test sequences.

FIG. 22 shows that the bit rate changes generally monotonically with QP.

Referring to FIG. 23, the PSNR for bitDepth=8 and bitDepth=10 increasessharply at QPs of 4 and below (rightmost three data points on eachcurve). At QP 4, the quantisation divisor for 8-bit is 1 (QP −8 for 10bit), leaving the mismatch between the DCT and IDCT and between thequantisation and dequantisation coefficients as the only probablesources of error. As the system tends towards lossless processing, theMSE approaches zero and the SNR spikes upward FIG. 24 is a graph of PSNRagainst bit rate for one test sequence at a series of different internalbit depths (8, 10, 12, 14, 16). The five curves overlie one anotheralmost exactly for most of their range and so cannot easily bedistinguished.

A 10-bit system at the same operating point has errors mainly in the twoleast significant bits, meaning it also approaches lossless processingwhen considering only 8-bit accuracy, but as indicated elsewhere in thisdescription, the act of converting 10-bit video to 8-bit video must alsobe considered. This will add a MSE of 1.5, which is hidden (that is tosay, not shown explicitly as a result in these empirical tests but stillresulting in a higher overall SNR) when considering a lower accuracy.

In systems that are not limited by internal accuracy to a peak SNR, thisincrease towards lossless processing can be seen for each bitDepth as QPdrops below (4−(6*(bitDepth−8))). This is shown in FIG. 25, which is agraph of green channel PSNR against bit rate for a range of bit depths(8, 10, 12, 14, 16) with MAX_TR_DYNAMIC_RANGE=21,ENTROIPY_CODING_DYNAMIC_RANGE=21 and 14 bit transform matrices, withRDOQ disabled and transform skip disabled. The five curves overlie oneanother except for portions 1420 (of the 8 bit curve), 1430 (of the 10bit curve), 1440 (of the 12 bit curve), 1450 (of the 14 bit curve) and1460 (of the 16 bit curve). It can be seen that, for the same number ofbits, significantly higher SNRs are achievable than those shown in FIG.24.

The empirical results have shown that in embodiments of the presentdisclosure, the transform matrix precision should be at leastbitDepth−2. FIG. 26 is a graph of PSNR against bit rate for the greenchannel of one test sequence with bitDepth=10 andMAX_TR_DYNAMIC_RANGE=17, comparing various precision DCT matrices.

In embodiments, MAX_TR_DYNAMIC_RANGE should be at least 5 (which is theminimum value of log₂(size)) more than bitDepth. Additional accuracy hasbeen shown to further improve coding efficiency.

In embodiments, ENTROPY_CODING_DYNAMIC_RANGE should be at least 6 morethan the bitDepth (1 for the “quantisation” factor applied by QPs lessthan (4−(6*(bitDepth−8))) plus 5 for the maximum value of log₂(size)).In other embodiments, where the clipping for the lowest QP values is nota concern, then the ENTROPY_CODING_DYNAMIC_RANGE should be at least 5(the minimum value of log₂(size)) more than bitDepth.

For the 16-bit system, the transform matrix precision should be set to14, MAX_TR_DYNAMIC_RANGE should be set to 21, andENTROPY_CODING_DYNAMIC_RANGE should be set to 22. Since having moreinternal accuracy is rarely considered harmful, these parameters havealso been tested at different bitDepths, producing results whichdemonstrate that, for the same number of bits, significantly higher SNRsare achievable, and that the increased-accuracy system has PSNR/MSEoperating points that are suitable for bitDepths of up to 16.

If Range Extensions is intended to produce a single new profile for allbit depths, then the system described above is suitable. However, ifdifferent profiles are to be described for different maximum bitDepths,then having different parameter values may be useful for reducinghardware complexity in systems that do not require the highest profiles.In some embodiments, the different profiles may define different valuesfor transform matrix precision, MAX_TR_DYNAMIC_RANGE andENTROPY_CODING_DYNAMIC_RANGE.

In other embodiments, the profile would allow the values of some or allof transform matrix precision, MAX_TR_DYNAMIC_RANGE andENTROPY_CODING_DYNAMIC_RANGE to be chosen from a list of permissiblevalues by the encoder (with the cost of implementation being a selectioncriterion), or a function of side information such as the bitDepth.However, this may require multiple sets of transform matrices if thetransform matrix precision is to be varied and for this reason, infurther embodiments only one transform matrix precision is defined for aprofile, with that transform matrix precision corresponding to therecommended value for the maximum bit depth for which the profile isdesigned. A set of possible profiles is proposed below with reference toFIG. 28.

Examples values of transform matrix precision, MAX_TR_DYNAMIC_RANGE,ENTROPY_CODING_DYNAMIC_RANGE and bitDepth are shown in the followingtable:

bitDepth 16 15 14 13 12 11 10 9 8 Transform Matrix Precision 14 13 12 1110 9  8‡  7‡ 6 MAX_TR_DYNAMIC_RANGE 21 20 19 18 17 16 15 15* 15*ENTROPY_CODING_DYNAMIC_RANGE 22 21 20 19 18 17  16^(†) 15  15*

In the table, values marked with a ‘*’ are clipped to a minimum of 15,in line with the current description of HEVC. The values marked with ‘†’and ‘‡’ are greater than those specified for the current description ofHEVC, those being 15 and 6 respectively.

If different profiles are to be used, then in embodiments of thedisclosure these specifications may be used as minima (noting that theHEVC version 1 10-bit system does not quite meet these targets). Usingvalues less than these indicated minima is possible, although this willdegrade the PSNR for higher bit rates (lower QPs).

Accordingly, the table above gives an example of an arrangement in whichthe precision and/or dynamic range of one or more coding (andcomplementary decoding) stages is set according to the bit depth of thevideo data.

In some embodiments, however, the luma and chroma data can havedifferent bit depths.

Accordingly, in such situations, although the precision and/or dynamicrange values could be set differently (as between luma and chroma data),so that one set of values is adopted for luma data and another,potentially different set of values is adopted for chroma data,embodiments of the present disclosure handle this matter in a differentway.

Some embodiments recognise that it can be advantageous, from the pointof view of implementational efficiency, to use the same precision and/ordynamic range values for both luma and chroma data, while stillmaintaining the ability to vary those values according to bit depth. Theuse of the same parameters between the luma and chroma data allows asingle encoding path to be established for luma and chroma data,avoiding the need to set up (in either a software or a hardwareimplementation) two different, separately programmable or controllable,paths.

The selection of which set of parameters to use can be according to apredetermined rule. For example, the parameters relating to the lumadata can be selected. Alternatively, and giving improved flexibility ofoperation, the parameters according to that video component (forexample, luma, chroma) having the greatest bit depth of the videocomponents can be selected. So, for example, using the table above, ifthe luma bit depth were (say) 16 and the chroma bit depth were (say) 14,then the column of parameters relating to a bit depth of 16 would beused for luma and for chroma processing.

The bit depth and/or the relationship of the bit depth to the parametersdiscussed above and/or an index into a table of parameters such as thatshown above can be defined by one or more “parameter sets” of the videodata. At the highest level is a video parameter set (VPS), followed by(in decreasing level, corresponding to more granularity) a sequenceparameter set (SPS), where a sequence contains one or more pictures, apicture parameter set (PPS), and a slice parameter set, where a picturecontains one or more slices. The relationships or bit depths orprecision and/or dynamic range values can be defined by any of these,but in some embodiments they are defined by the SPS.

Accordingly, in the embodiments just described, the precision and/ordynamic range values for one or more coding stages are arranged to varyaccording to the video bit depth, such that if the bit depth differsbetween video components (for example, between luma and chroma data)then a predetermined rule is used to select a single set of precisionand/or dynamic range values for use with all of the video components.Similar considerations apply in respect of image data (rather than videodata). Similar principles apply at the encoder and decoder. Accordingly,these arrangements can also provide an example of an arrangement inwhich, for input or output image data having image components ofdifferent bit depths, a single set of the maximum dynamic range and/orthe data precision of the transform matrices is selected for use withall of the image components.

In some embodiments, the single set of the maximum dynamic range and/orthe data precision of the transform matrices is selected as those valuesrelating to that one of the image components having the greatest bitdepth.

Note that at the decoder side, and in the inverse path of the encoder,in some embodiments the same (or one or both of the same) maximumdynamic range and/or the data precision of the transform matrices may beused as those used at the encoder side. In other embodiments, the dataprecision of the inverse (decoder side) transform matrices is set to apredetermined value such as 6.

Examples of these arrangements will be described further below withrespect to FIGS. 38 and 39.

Turning now to the CABAC system, as discussed above this provides anexample of an encoding technique involving selecting one of a pluralityof complementary sub-ranges of a set of code values according to thevalue of a current input data value, the set of code values beingdefined by a range variable, assigning the current input data value to acode value within the selected sub-range, modifying the set of codevalues in dependence upon the assigned code value and the size of theselected sub-range, and detecting whether the range variable definingthe set of code values is less than a predetermined minimum size and ifso, successively increasing the range variable so as to increase thesize of the set of code values until it has at least the predeterminedminimum size; and outputting an encoded data bit in response to eachsuch size-increasing operation. In embodiments, the proportions of thesub-ranges relative to the set of code values are defined by a contextvariable associated with the input data value. Embodiments of the CABACarrangement involve: following the coding of an input data value,modifying the context variable, for use in respect of a next input datavalue, so as to increase the proportion of the set of code values in thesub-range that was selected for the current input data value.

Also as discussed above, in some embodiments the HEVC CABAC entropycoder codes syntax elements using the following processes:

The location of the last significant coefficient (in scan order) in theTU is coded.

For each 4×4 coefficient group (groups are processed in reverse scanorder), a significant-coefficient-group flag is coded, indicatingwhether or not the group contains non-zero coefficients. This is notrequired for the group containing the last significant coefficient andis assumed to be 1 for the top-left group (containing the DCcoefficient). If the flag is 1, then the following syntax elementspertaining to the group are coded immediately following it: Significancemap; Greater-than-one map; Greater-than-two flag; Sign bits; and Escapecodes.

This arrangement is illustrated schematically in FIG. 29. At a step1500, the CABAC encoder checks whether a current group contains the lastsignificant coefficient. If so, the process ends. If not, the processproceeds to a step 1510 at which the encoder checks whether the currentgroup is the top-left group containing the DC coefficient. If so,control passes to a step 1530. If not, at a step 1520, the encoderdetects whether the current group contains non-zero coefficients. Ifnot, the process ends. If so, then at the step 1530 a significance mapis generated. At a step 1540, a >1 map is generated which indicates, forup to 8 coefficients with significance map value 1, counted backwardsfrom the end of the group, whether the magnitude is greater than 1. At astep 1550, a >2 map is generated. For up to 1 coefficient with >1 mapvalue of 1 (the one nearest the end of the group), this indicateswhether the magnitude is greater than 2. At a step 1560, sign bits aregenerated and ante step 1570, escape codes are generated for anycoefficient whose magnitude was not completely described by an earliersyntax element (that is to say, data generated in any of the steps1530-1560).

For a 16-bit, 14-bit or even 12-bit system at the operating point wherethe MSE is less than 1 (typically at QPs −34, −22 and −10 respectively),the system typically yields very little compression (for 16-bit, itactually inflates the source data). The coefficients are generally largenumbers, and therefore are almost always escape-coded. For that reason,two proposed changes have been made to the entropy coder to allow forhigher bit depths by placing a fixed number of LSBs, B_(F), in the bitstream for each coefficient. In essence the schemes permit the currentHEVC CABAC entropy coder, which was developed for 8 and 10-bitoperation, to operate at the original bitDepth for which it wasdesigned, by effectively converting a higher-bit system, such as 16-bit,into a lower-bit system, such as 10-bit, with an alternative path forthe additional accuracy. The effectiveness of the splitting methodemployed is aided since the lower-bit system values are significantlymore predictable and therefore suitable for encoding with more complexencoding schemes, whereas the additional accuracy required by thehigher-bit system is less predictable and therefore less compressibleand complex encoding schemes are less effective. For example a 16-bitsystem could configure B_(F) to be 8.

The use of the fixed bits schemes is indicated in the bit-stream by theencoder, and when a scheme is used, the means to determine the number offixed bits would indicated by the encoder to the decoder. Those meanswould be either encoding the number directly, or indicating how toderive the value B_(F) from parameters present in the bit-stream(including QP, bit depth, and/or profile) already coded in thebit-stream, or a combination thereof. The encoder would also have theoption to indicate different B_(F) values for different Pictures, Slicesand CUs, using the same means, or by indicating delta values to theB_(F) value derived for the sequence, picture, slice or preceding CU.The value of B_(F) may also be configured to be different for thedifferent transform unit block sizes, the different prediction types(inter/intra), and different colour channel, where the nature of thesource video would steer the encoder in choosing different parameters.

An example derivation for B_(F) based on QP is as follows:

B _(F)=max(0,int(QP/−6))

An example derivation for B_(F) based on the bit depth is as follows:

B _(F)=bitDepth−8

An example derivation for B_(F) based on the transform unit block sizeand QP:

B _(F)=max(0,int(QP/−6)+2−log₂(size))

The various values of B_(F) could be determined in an encoder using apre-coder (trial) arrangement, or could be configured to followpre-determined rules.

Entropy Coding Embodiment 1

To allow for processing at higher bit depths, the process of the HEVCentropy coder is changed to the following for a number of fixed bitsB_(F) less than bitDepth:

The location of the last significant coefficient (in scan order) in theTU is coded.

For each 4×4 coefficient group (groups are processed in reverse scanorder), each coefficient C is split into a most-significant part C_(MSB)and a least-significant part C_(LSB), where

C _(MSB)=abs(C)>>B _(F)

C _(LSB)=abs(C)−(C _(MSB) <<B _(F))

and B_(F) is the number of fixed bits to use, as determined from the bitstream.

The generation of C_(MSB) and C_(LSB) as discussed provide an example(in respect of a technique for encoding a sequence of data values) ofgenerating, from the input data values, respective complementarymost-significant data portions and least-significant data portions, suchthat the most-significant data portion of a value represents a pluralityof most significant bits of that value, and the respectiveleast-significant data portion represents the remaining leastsignificant bits of that value.

A significant-coefficient-group flag is coded, indicating whether or notthe group contains non-zero values of C_(MSB). This is required for thegroup containing the last significant coefficient and is assumed to be 1for the top-left group (containing the DC coefficient). If the flag is1, then the following syntax elements pertaining to the group are codedimmediately following it:

Significance Map:

For each coefficient in the group, a flag is coded indicating whether ornot the value of C_(MSB) is significant (has a non-zero value). The flagis coded for the coefficient indicated by the last-significant position.

Greater-than-One Map:

For up to eight coefficients with significance map value 1 (countedbackwards from the end of the group), this indicates whether C_(MSB) isgreater than 1.

Greater-than-Two Flag:

For up to one coefficient with greater-than-one map value 1 (the onenearest the end of the group), this indicates whether C_(MSB) is greaterthan 2.

Fixed Bits:

For each coefficient in the group, the value of C_(LSB) is coded asbypass data using equiprobable CABAC bins.

Sign Bits:

For all non-zero coefficients, sign bits are coded as equiprobable CABACbins, with the last sign bit (in reverse scan order) possibly beinginstead inferred from parity when sign bit hiding is used.

Escape Codes:

For any coefficient whose magnitude was not completely described by anearlier syntax element, the remainder is coded as an escape code.

However, where the significant-coefficient-group flag is a 0, then thefollowing syntax elements pertaining to the group are coded immediatelyfollowing it:

Fixed Bits:

For each coefficient in the group, the value of C_(LSB) is coded asequiprobable CABAC bins.

Sign Bits:

For all non-zero coefficients, sign bits are coded as equiprobable CABACbins, with the last sign bit (in reverse scan order) possibly beinginstead inferred from parity when sign bit hiding is used.

The generation of one or more of these maps and flags provides anexample of generating one or more data sets indicative of positions,relative to the array of the values, of most-significant data portionsof predetermined magnitudes. The encoding of one or more maps usingCABAC provides an example of encoding the data sets to an output datastream using binary encoding. The encoding of other data usingequiprobable CABAC bins provides an example of including data definingthe less-significant portions in the output data stream, or (using otherterminology) an example of including data defining the less-significantdata portions in the output data stream comprises encoding theleast-significant data portions using arithmetic coding in which symbolsrepresenting the least-significant data portions are encoded accordingto respective proportions of a coding value range, in which therespective proportions of the coding value range for each of the symbolsthat describe the least-significant data portion are of equal size. Asan alternative to equiprobable CABAC encoding, however, the step ofincluding data defining the less-significant portions in the output datastream can comprise directly including the least-significant dataportions in the output data stream as raw data.

An embodiment of this disclosure changes the interpretation of thesignificant coefficient group flag to indicate whether any of thecoefficients are non-zero (not just their C_(MSB) counterparts). In thiscase, the coefficient group containing the last coefficient in thereverse scan order would not need to be indicated (as it would be 1),and additional syntax elements would not needed to be coded when thesignificant-coefficient-group flag is a 0. This provides an example ofwhich the significance map comprising a data flag indicative of theposition, according to a predetermined ordering of the array of values,of the last of the most-significant data portions having a non-zerovalue.

This latter arrangement is illustrated schematically in FIG. 30 whichcorresponds in many respects to FIG. 29. Comparing the two drawings, itwill be seen that FIG. 30 has no equivalent of the step 1500 of FIG. 29,corresponding to the fact that the process takes place even for thegroup containing the last significant coefficient. Steps 1610 and 1620generally correspond to the steps 1510 and 1520 of FIG. 29. At a newlyintroduced step 1625, the coefficients are split into MSB and LSBportions as discussed above. Steps 1630, 1640 and 1650 generallycorrespond to respective steps 1530, 1540 and 1550 of FIG. 29 exceptthat they act only on the MSB portion of the split coefficients. A newlyintroduced step 1655 involves encoding the LSB portions of the splitcoefficients as fixed bits as discussed above. Steps 1660 and 1670generally correspond to the steps 1560 and 1570 of FIG. 29.

This modification can effectively produce a system where the CABACentropy coder is operating at the original bitDepth for which it wasdesigned, by selecting B_(F) so that a number of MSBs equal to thedesign bit depth of the encoder is passed through the CABAC encoding,with the higher bit depth's LSBs (which are the least predictable andtherefore least compressible) being bypass-coded. For example, if theencoder is an 8 or 10 bit depth encoder, B_(F) could equal 8 or 10. Thisprovides an example of a system in which the sequence of data valuesrepresent image data having an image data bit depth; and the methodcomprises setting the number of bits to be used as the plurality of mostsignificant bits in each most-significant data portion to be equal tothe image data bit depth.

As discussed, the techniques may (in some embodiments) be applied toarrangements in which the sequence of data values comprises a sequenceof frequency transformed image coefficients. However, other types ofdata (such as audio or simply numerical data) could be used. The resultsfor this proposal can be seen in FIG. 27, which is a graph of PSNRagainst QP for one test sequence with the DCT matrix precision andMAX_TR_DYNAMIC_RANGE set according to bit depth, showing equivalentoperations with (the curve 1680) and without (the curve 1690) bypassfixed-bit encoding. The saving in bit rate for the system with fixedbits (relative to the system without fixed bits) varies from 5% at QP 0up to 37% at QP −48. The best value of B_(F) will be sequence dependent.An example of B_(F) is 8 or 10 as discussed above.

Entropy Coding Embodiment 2

A similar scheme under other embodiments applies many of the sameprocessing steps, but retains the original functionality of thesignificance map—where a flag value of 0 indicates a coefficient valueof 0 (rather than—as in the Entropy Coding Embodiment 1—a value of 0 forthe MSB portion of the coefficient). This may be more useful whenconsidering (typically smooth) computer generated video (where zeros areexpected to be more common). This Entropy Coding Embodiment comprisesthe following processing steps for a number of fixed bits B_(F) lessthan bitDepth:

The location of the last significant coefficient (in scan order) in theTU is coded.

For each 4×4 coefficient group (groups are processed in reverse scanorder), a significant-coefficient-group flag is coded, indicatingwhether or not the group contains non-zero coefficients. This is notrequired for the group containing the last significant coefficient andis assumed to be 1 for the top-left group (containing the DCcoefficient). If the flag is 1, then each coefficient C is split into amost-significant part C_(MSB) and a least-significant part C_(LSB),where

C _(MSB)=(abs(C)−1)>>B _(F)

and

C _(LSB)=(abs(C)−1)−(C _(MSB) <<B _(F))

The generation of C_(MSB) and C_(LSB) as discussed provide an example(in respect of a technique for encoding a sequence of data values) ofgenerating, from the input data values, respective complementarymost-significant data portions and least-significant data portions, suchthat the most-significant data portion of a value represents a pluralityof most significant bits of that value, and the respectiveleast-significant data portion represents the remaining leastsignificant bits of that value.

The following syntax elements pertaining to the group are codedimmediately following it:

Significance Map:

For each coefficient in the group, a flag is coded indicating whether ornot the coefficient C is significant (has a non-zero value). No flag isnecessary for the coefficient indicated by the last-significantposition.

Greater-than-One Map:

For up to eight coefficients with significance map value 1 (countedbackwards from the end of the group), this indicates whether C_(MSB) isgreater than or equal to 1.

Greater-than-Two Flag:

For up to one coefficient with greater-than-one map value 1 (the onenearest the end of the group), this indicates whether C_(MSB) is greaterthan or equal to 2.

Sign Bits:

For all non-zero coefficients, sign bits are coded as equiprobable CABACbins, with the last sign bit (in reverse scan order) possibly beinginstead inferred from parity when sign bit hiding is used.

Fixed Bits:

For each non-zero coefficient in the group, the value of C_(LSB) iscoded.

Escape Codes:

For any coefficient whose magnitude was not completely described by anearlier syntax element, the remainder is coded as an escape code.

The generation of one or more of these maps and flags provides anexample of generating one or more data sets indicative of positions,relative to the array of the values, of most-significant data portionsof predetermined magnitudes. The encoding of one or more maps usingCABAC provides an example of encoding the data sets to an output datastream using binary encoding. The encoding of other data usingequiprobable CABAC bins provides an example of including data definingthe less-significant portions in the output data stream.

Note that there are various options for the order of these variouscomponents of the data in the output stream. For example, with referenceto the sign bits, fixed bits and escape codes, the order for a group of(say) n coefficients (where n might be 16, for example) could be:

n×sign bits, then n×sets of fixed bits, then n×escape codes; or

n×sign bits, then n×(escape code and fixed bites for one coefficient).

This arrangement is schematically illustrated in the flowchart of FIG.31. Here, the steps 1700 . . . 1770 correspond to respective steps ofFIGS. 31 and 32 in the following way, unless a difference is identified.Note that the step 1755 follows the step 1760 in FIG. 31 (the similarstep 1655 preceded the step 1660 in FIG. 30).

The step 1700 corresponds generally to the step 1500 of FIG. 29. If thisis not the group containing the last significant coefficient, controlpasses to the step 1710. The steps 1710 and 1720 correspond to the steps1610 and 1620 of FIG. 30. The coefficients are split at the steps 1725corresponding to the step 1625 of FIG. 30. However, at the steps 1730,in contrast to the arrangement of the step 1630 discussed earlier, thewhole coefficient (ignoring, for the time being, the split executed inthe step 1725) is used in the derivation of the significance map. Thesteps 1740 and 1750 act on only the MSB portions of the splitcoefficients and correspond in function to the steps 1640 and 1650.Apart from the fact that the ordering of the steps is illustrated (byway of example) slightly differently between FIGS. 32 and 33, the steps1755, 1760 and 1770 correspond to the functionality of the steps 1655,1660 and 1670.

Results comparing these two Entropy Coding Embodiments can be seen inFIG. 28. FIG. 28 is a graph illustrating, for each of six testsequences, a bit rate percentage improvement for the Entropy CodingEmbodiment 2 relative to the results achieved (with otherwise identicalparameters) for the Entropy Coding Embodiment 1.

The Entropy Coding Embodiment 2 has been shown to be 1% less efficienton average for some source material than the Entropy Coding Embodiment 1for negative QPs, rising to approximately 3% for positive QPs. However,for some softer source material, the opposite is observed, due to theincreased presence of zeros in the coefficients. In an embodiment, theencoder would be able to choose either entropy coding method and signalto the decoder the choice.

Since the saving for positive QPs is small compared to the saving fornegative QPs, the entropy coding modifications could be enabled onlywhen QP is negative. Considering that the Entropy Coding Embodiment 1shows bit savings of up to 37% for negative QPs, there is littledifference between the two Entropy Coding Embodiments at these operatingpoints when compared to a system with no entropy coding modifications.

Accordingly, in example embodiments in which the frequency-transformedinput image coefficients are quantised frequency-transformed input imagecoefficients according to a variable quantisation parameter selectedfrom a range of available quantisation parameters, the techniques cancomprise encoding the array of frequency-transformed input imagecoefficients according to the most-significant data portions and theleast-significant data portions for coefficients produced using aquantisation parameter in a first predetermined sub-range of the rangeof available quantisation parameters; and for coefficients producedusing a quantisation parameter not in the first predetermined sub-rangeof the range of available quantisation parameters, encoding the array offrequency-transformed input image coefficients such that the number ofbits in each most-significant data portion equals the number of bits ofthat coefficient and the respective least-significant data portioncontains no bits.

Since the quantity of data being coded is somewhat higher than observedfor standard HEVC version 1 operating points, an additional stage is ormay be applicable to both proposed systems, and indeed a system wherethe previously proposed systems cannot be or are not enabled will now bediscussed in connection with further embodiments of the disclosure.

This additional stage causes the CABAC stream to be bit-aligned prior tocoding the bypass data for each coefficient group. This allows quicker(and in-parallel) decoding of the bypass data, since the values can nowbe read directly out of the stream, removing the requirement forlong-division when decoding bypass bins.

One mechanism to achieve this is to apply the CABAC termination methodpreviously presented above.

However, in the embodiment now described, instead of terminating thebit-stream, the CABAC state is aligned to a bit boundary.

In embodiments, the set of CABAC code values comprises values from 0 toan upper value defined by the range variable, the upper value beingbetween the predetermined minimum size (for example, 256) and a secondpredetermined value (for example, 510).

To bit-align the stream, m_Range is simply set to 256 in both theencoder and decoder. This significantly simplifies the encoding anddecoding process, allowing the binary data to be read directly out ofm_Value in raw form, and therefore many bits at a time cansimultaneously be processed by the decoder.

Note that the act of setting m_Range to 256 incurs a loss of, onaverage, 0.5 bits (if m_Range was already 256, there is no loss; ifm_Range was 510, then approximately 1 bit will be lost; the average overall valid values of m_Range is therefore 0.5 bits).

A number of methods can be used to mitigate the loss, or potential cost,incurred by these techniques. FIGS. 33 to 35 are schematic flowchartsrespectively illustrating versions of a termination stage of a CABACprocess as carried out by the CABAC encoder.

According to FIG. 33, whether or not to bit-align could be selecteddepending on an estimate of the expected quantity of bypass-coded data(for example, based on the number of greater-than-one flags equal to 1).If few bypass-coded data are expected, bit-aligning is costly (as itwastes on average 0.5 bits per alignment), and also unnecessary sincethe bitrate is likely to be lower. Accordingly, in FIG. 33, a step 1800involves detecting the estimated quantity of bypass-encoded data bydetecting the number of >1 flags which have been set, and comparing thatnumber to a threshold value Thr. If the estimate exceeds the thresholdThr then control passes to a step 1810 at which the bit align mode isselected. Otherwise, control passes to a step 1820 at which thenon-bit-align mode is selected. The steps of FIG. 33 can be repeatedeach sub-group in each TU, for example. This provides an example ofencoding data representing coefficients which are not represented a dataset as bypass data; detecting the quantity of bypass data associatedwith a current array; and applying the setting step if the quantity ofbypass data exceeds a threshold amount, but not applying the settingstep otherwise.

Referring to FIG. 34, rather than coding bypass data at the end of eachcoefficient group, all the bypass data for a TU can be coded togetherafter the CABAC bin data for the TU. The loss is therefore 0.5 bits percoded TU, rather than 0.5 bits per coefficient group. Accordingly, at astep 1830 in FIG. 34, a test is applied to detect whether the currentgroup is at the end of encoding a TU. If not, then bit alignment is notapplied (indicated schematically as a step 1840) and control returns tothe step 1830. But if so, then bit alignment is applied at a step 1850.This provides an example of an arrangement in which the input datavalues represent image data; and in which the image data are encoded astransform units comprising a plurality of arrays of coefficients, themethod comprising applying the setting step at the end of encoding atransform unit.

This alignment mechanism may also be used prior to other or all data inthe stream that are coded with a equiprobable mechanism, which althoughit may decrease the efficiency, may simplify the coding of the stream.

As an alternative alignment, referring to FIG. 35, m_Range can be set toone of a number N of predetermined values rather than simply 256 (384,for example, would align to a half-bit). Since the aligning value mustbe less than or equal to the original value of m_Range (as range cannotbe increased other than through renormalisation), the loss-per-alignmentis then (0.5/N) for regularly spaced values. This method would stillrequire division for values other than 256, but the denominator would beknown in advance and so the division could be evaluated using a look-uptable. Accordingly, at a step 1860 (which applies in a bit alignmentsituation) the value of m_range is detected, and at a step 1870 analigned value is selected according to m_range for use in the bitalignment process.

As a further refinement to this alternative alignment method, the bin(or bins) immediately following the alignment can be coded using(unequal) symbol ranges that are powers of two. In this way, allrequirements for division for subsequent bins can be removed without anyfurther loss over (0.5/N) in bit efficiency.

For example, when aligning to 384, the symbol ranges for [0,1] for thesubsequent bin can be [256,128]:

If a 0 is coded, m_Range is set to 256, making the cost to encode thebin 0.5 bits.

If a 1 is coded, m_Range is set to 128 (and 256 is added to m_Value) andthe system is renormalised (again, m_Range becomes 256), making the costto encode the bin 1.5 bits.

Since 0 and 1 are expected with equal probability, the average cost toencode the bin immediately following alignment is still 1 bit. For thecase where N=2, and the two alignment points are 256 and 384, the methodwould be to pick the largest alignment point that is less than or equalto the current m_Range. If that alignment point is 256, then m_Range isjust set to 256 to align the CABAC engine; if the alignment point is384, then the above process is required, which would require the codingof one symbol.

This is shown in FIGS. 32A and B, and a further example with N=4 isshown in FIGS. 32C to 32F.

To illustrate the advantages of aligning the CABAC engine, the method todecode an equiprobable (EP) bin without this alignment stage might beexpressed as follows:

-   -   if (m_Value>=m_Range/2)        -   the decoded EP value is a 1. Decrement m_Value by m_Range/2    -   else        -   the decoded EP value is a 0.    -   then, read next bit from the bit-stream:        -   m_Value=(m_Value*2)+next_bit_in_stream

A worked example of this is then:

-   -   let m_Range=458 and m_Value=303 and assume the next two bits in        the bitstream are 1    -   cycle 1:        -   m_Value>=229, so the next coded EP value is 1. m_Value=74        -   then, read next bit from the bit-stream: m_Value=74*2+1=149    -   cycle 2:        -   m_Value<229, so the EP value is 0 (m_Value unchanged)        -   then, read next bit from the bit-stream: m_Value=149*2+1=299

The decoded equiprobable bins are equivalent to one stage of longdivision, and arithmetic would be required to test the inequality. Todecode two bins, then this example process would be used twice,implementing a two-stage long division process.

However, if the alignment stage is applied, resulting in m_Range beingthe largest valid power of 2 (such as 256 for the 9-bit HEVC CABACentropy coder), then the above process is simplified

-   -   the coded EP value is the most significant bit of m_Value.    -   Update m_Value, by treating it as a shift register, shifting in        the next bit in the stream into the least significant position.

Hence, m_Value essentially becomes a shift register, and the EP bins areread from the most significant position, whilst the bit-stream isshifted into the least significant position. Therefore multiple EP bitscan be read by simply shifting more bits off the top of m_Value.

A worked example of this aligned case is:

-   -   Let m_Range=256, m_Value=189 and the next two bits in the        bitstream are 1    -   cycle 1:        -   Next coded EP value is bit 7 of m_Value, which is a 1.        -   Update m_Value by shifting out bit 7, and shifting in 1 from            the bit stream into the least significant position: m_Value            becomes 123.    -   cycle 2:        -   Next coded EP value is bit 7 of m_Value, which is a 0.        -   Update m_Value by shifting out bit 7, and shifting in 1 from            the bit stream into the least significant position: m_Value            becomes 247.

The number of alignment points, N, that are selected can be seen as atrade-off between complexity of implementation and the bit-cost ofalignment. For an operating point where there are many EP bins peralignment point, then the wastage is less significant, and an alignmentsystem with fewer points may suffice. Conversely, for an operating pointwhere there are fewer EP bins per alignment point, then the wastage ismore significant, and an alignment system with more points may bepreferable; for some operating points disabling the alignment algorithmentirely may be preferable. The encoder, and therefore bit-stream, couldindicate the number of alignment points that are to be used by thedecoder, which may be chosen according to the operating point for thatsection of the data stream. This number indicated may alternatively beinferred from other information present in the bit-stream, such as aprofile or level.

Using multiple alignment positions, in a simple case, where thealignment positions are just 256 and 384:

To align, if m_Range < 384, just set m_Range=256, and see above workedexample for decoding. else set m_Range=384, and the following process isused for coding the next EP bin: m_Range=384=256+128. Assign the symbolrange of 256 to the value of 0 and 128 to the value of 1 for the next EPbin to be coded. If m_Value >= 256, then (a MSB bit test operation) thenext EP value is a 1. m_Value−=256 (actually is a bit-clear operation)m_Range=128. Renormalise (because m_Range<256): m_Range=256m_Value=(m_Value*2) + next_bit_in_stream else the next EP value is a 0.m_Range=256. Then, m_Range=256, and the above simple process can be usedfor all subsequent EP bins.

The results for Entropy Coding Embodiment 1 with the CABAC bit-alignmentmechanisms just discussed are shown in FIG. 29, which is a graph of bitrate difference against QP for six sequences with and without the bitalignment mechanisms for N=1. A positive bit rate difference (on thevertical axis) indicates that the system with bit alignment generates ahigher bit rate than the scheme without the bit alignment mechanism. Thebit rate difference for each sequence is approximately 0.5 times thenumber of thousand coefficient groups per second (Traffic is 2560×160030p=11520, all others are 1920×1080 50p=9720).

The alignment techniques discussed above are examples of: after encodinga group of input data values, setting the range variable to a valueselected from a predetermined subset of available range variable values,each value in the subset having at least one least significant bit equalto zero. The subset may include the minimum size (example, 256). Thesubset may comprise two or more values between the predetermined minimumsize (such as 256) and the second predetermined value (such as 510). Avalue may be selected from the according to a current value of the rangevariable. Embodiments involve selecting a particular value from thesubset if the current value of the range variable is between thatparticular value and one less than a next-higher value in the subset (asshown, for example, in FIGS. 32A-32F). In a particular example, thesubset of available values comprises a set consisting of 256, 320, 384and 448; the step of setting the range variable comprises selecting avalue from the subset according to a current value of the rangevariable, so that the range variable is set to 256 if the current valueof the range variable is between 256 and 319, the range variable is setto 320 if the current value of the range variable is between 320 and383, the range variable is set to 384 if the current value of the rangevariable is between 384 and 447, and the range variable is set to 448 ifthe current value of the range variable is between 448 and 510. Inanother example, the step of setting the range variable comprisesselecting a value from the subset according to a current value of therange variable, so that the range variable is set to 256 if the currentvalue of the range variable is between 256 and 383, and the rangevariable is set to 384 if the current value of the range variable isbetween 384 and 510.

The options set out in FIG. 30 are proposed as profiles.

If the High profile(s) are only required to support bitDepths of up to14, then the transform matrix coefficient precision,MAX_TR_DYNAMIC_RANGE and ENTROPY_CODING_DYNAMIC_RANGE are proposed to beset to 12, 19 and 20 respectively.

In addition to these profiles, intra-only Main/Extended profiles couldbe defined, but since an intra-only decoder is significantly lesscomplex than an intra/inter decoder, only a High intra profile has beendescribed here.

In a similar vein, Extended/High profiles for coding still pictures invarious chroma formats could be defined.

Lower profiles could need to use the same matrix Precision,MAX_TR_DYNAMIC_RANGE and ENTROPY_CODING_DYNAMIC_RANGE as used by thehigher profiles else the bit-streams produced by the two Profiles wouldnot match.

Various options will now be discussed:

Option 1 Bit Depth 16 15 14 13 12 11 10 . . . High Transform MatrixPrecision 14 13 12 11 10 9 8 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE 21 20 1918 17 16 15 . . . ENTROPY_CODING_DYNAMIC_RANGE 22 21 20 19 18 17 16 . .. Bit Depth — — — — 12 11 10 . . . Extended Transform Matrix Precision —— — — 10 9 8 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE — — — — 17 16 15 . . .ENTROPY_CODING_DYNAMIC_RANGE — — — — 18 17 16 . . .

In this option, the bit depth will dictate the transform matrixprecision, MAX_TR_DYNAMIC_RANGE and ENTROPY_CODING_DYNAMIC_RANGE. Thismeans that a decoder that would need to support bit depths up to 16would need to process 13 bit data with a different set of matrices, andthe internal accuracy would be limited to just 18 bits forMAX_TR_DYNAMIC_RANGE, although the decoder would have the ability tosupport up to 21. However, 12 bit data encoded using the high profilecould be decoded by a decoder compliant at a lower profile.

Option 2 Bit Depth 16 15 14 13 12 11 10 . . . High Transform MatrixPrecision 14 14 14 14 10 10 10 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE 21 21 2121 17 17 17 . . . ENTROPY_CODING_DYNAMIC_RANGE 22 22 22 22 18 18 18 . .. Bit Depth — — — — 12 11 10 . . . Extended Transform Matrix Precision —— — — 10 10 10 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE — — — — 17 17 17 . . .ENTROPY_CODING_DYNAMIC_RANGE — — — — 18 18 18 . . .

In this option, the bit parameters for the overlapping bit depths aredetermined by the lower profile, thereby making decoding 12-bit dataencoded using the high profile decodable using a decoder compliant tothe extended profile. In addition, the internal accuracy of 13 bit datawould be the same as for the 16 bit data. In addition, few matrixprecisions would need to be supported than in Option 1.

In the present context, a single set of transform matrix values could bestored, and all other values derived from this.

Note that if the transform matrices have an initial precision of 14bits, generally the lower precisions could be derived by divide by twoand rounding.

Using this general rule to derive the lower-precision matrices fromhigher precision matrices would lead to:

Example 1

Option 1: High Define transform matrix precision = 14 4:4:4 Derivetransform matrix precision = 13 . . . from 14 Ext Define transformmatrix precision = 14 4:4:4 Derive transform matrix precision = 10 . . .from 14 i.e. Store at “High” precision.

Example 2

Option 1: High Define transform matrix precision = 10 4:4:4 Derivetransform matrix precision = 14 . . . from 10 Ext Define transformmatrix precision = 10 4:4:4 Derive transform matrix precision = 10 . . .from 4 i.e. Store at “Extended” precision.

For better quality “Example 1” is preferred. However Example 2 can leadto reduced storage requirements.

Note—An alternative is of course to store a transform matrix set foreach precision. “Example 1” and “Example 2” rules can also be used for“Option 2”.

As an aim is to increase quality and also split into profiles, therewill be scaling errors if each transform matrix set is derived from asingle set at one precision.

In the case of “Example 1” the system is down-scaling the transformmatrices from 14 bits, and in the case of “Example 2” the system isup-scaling and down-scaling the transform matrices from 10 bits.

Option 3 Bit Depth 16 15 14 13 12 11 10 . . . High Transform MatrixPrecision 14 14 14 14 14 14 14 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE 21 21 2121 21 21 21 . . . ENTROPY_CODING_DYNAMIC_RANGE 22 22 22 22 22 22 22 . .. Bit Depth — — — — 12 11 10 . . . Extended Transform Matrix Precision —— — — 10 10 10 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE — — — — 17 17 17 . . .ENTROPY_CODING_DYNAMIC_RANGE — — — — 18 18 18 . . .i.e. Bit Depths of 12 bit Video can be encoded either as “High 4:4:4” or“Ext 4:4:4”, although only a high 4:4:4 decoder would be able to decodestreams encoded using the high 4:4:4 scheme.

Option 4 Bit Depth 16 15 14 13 12 11 10 . . . High Transform MatrixPrecision 14 14 14 14 — — — . . . 4:4:4 MAX_TR_DYNAMIC_RANGE 21 21 21 21— — — . . . ENTROPY_CODING_DYNAMIC_RANGE 22 22 22 22 — — — . . . BitDepth — — — — 12 11 10 . . . Extended Transform Matrix Precision — — — —10 10 10 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE — — — — 17 17 17 . . .ENTROPY_CODING_DYNAMIC_RANGE — — — — 18 18 18 . . . i.e. “High 4:4:4”Profile has to support the lower “Ext 4:4:4 Profile”, with this “Option4” there is only one choice on how to code 12-bit video.

Option 5 Bit Depth 16 15 14 13 12 11 10 . . . High Transform MatrixPrecision 14 14 14 14 14 14 14 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE 21 20 1918 17 16 15 . . . ENTROPY_CODING_DYNAMIC_RANGE 22 21 20 19 18 17 16 . .. Bit Depth — — — — 12 11 10 . . . Extended Transform Matrix Precision —— — — 10 10 10 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE — — — — 17 16 15 . . .ENTROPY_CODING_DYNAMIC_RANGE — — — — 18 17 16 . . .In this option, the matrix precisions are limited to just 1 value perprofile, reducing the overhead for an encoder. In addition,MAX_TR_DYNAMIC_RANGE and ENTROPY_CODING_DYNAMIC_RANGE are dictated bythe bit depth, and therefore an encoder that only requires coding 13 bitdata would not need to include the implementation overhead of usingadditional internal calculation accuracy.

Option 6 Bit Depth 16 15 14 13 — — — . . . High Transform MatrixPrecision 14 14 14 14 — — — . . . 4:4:4 MAX_TR_DYNAMIC_RANGE 21 20 19 18— — — . . . ENTROPY_CODING_DYNAMIC_RANGE 22 21 20 19 — — — . . . BitDepth — — — — 12 11 10 . . . Extended Transform Matrix Precision — — — —10 10 10 . . . 4:4:4 MAX_TR_DYNAMIC_RANGE — — — — 17 16 15 . . .ENTROPY_CODING_DYNAMIC_RANGE — — — — 18 17 16 . . .Option 6 is similar to Option 5, but where only the extended profilesare defined for coding 12 bit data.

In summary, the proposed changes according to various embodiments of thepresent disclosure are:

Use at least one additional transform matrix set for higher accuracy.

It is preferable to have a single set for all higher accuracies, tosimplify multi-profile encoders/decoders.

Proposed transform matrices are provided for transform matrix precisions7 to 14—see the description below.

It is suggested to use the 14-bit accuracy transform matrices as thesewill fit within 16-bit data types for software, and will providesufficient accuracy to allow future extension to 16-bit video.

The choice of transform matrix precision could be configured by the bitdepth of the input data and the profile, or alternately determined byparameters specified at the sequence, picture or slice level.

MAX_TR_DYNAMIC_RANGE and ENTROPY_CODING_DYNAMIC_RANGE (that is to say,one or both of them) can be changed for higher accuracy.

Multiple values of MAX_TR_DYNAMIC_RANGE and ENTROPY_CODING_DYNAMIC_RANGEshould not present a problem for multi-profile encoders/decoders.

It is suggested to derive MAX_TR_DYNAMIC_RANGE=bitDepth+5 andENTROPY_CODING_DYNAMIC_RANGE=bitDepth+6.

The use of MAX_TR_DYNAMIC_RANGE=bitDepth+5 can be appropriate for manysituations and types of video material. However, a possible need for avariation of this will now be discussed.

Empirical tests have shown that in some instances, for a subset of videosequences, particularly some video sequences having a low noise content,the use of MAX_TR_DYNAMIC_RANGE=bitDepth+5 gives rise to a responsecurve (giving the relationship between output bitrate and quantisationparameter) is not monotonic.

Normally such a response curve is monotonic as between output bitrateand quantisation parameter, so that a harsher quantisation gives a loweroutput bitrate, and a less harsh quantisation gives a higher outputbitrate. This monotonic relationship forms the basis of rate controlalgorithms, so that the rate control system adjusts the quantisationparameter to keep the output bitrate within a desired range or under adesired threshold.

But in some instances of the use of MAX_TR_DYNAMIC_RANGE=bitDepth+5, themonotonic relationship has been found to break down, so that, forexample, a change to a less harsh quantisation can in fact give rise toa lower output bitrate, or even that there can be two possible values ofpicture SNR for a particular output bitrate. These aberrations can causethe rate control algorithm to struggle or even fail to arrive at adesired bitrate.

In empirical tests it has been found that such problems can be overcomeby using MAX_TR_DYNAMIC_RANGE=bitDepth+6. Accordingly, in someembodiments, this relationship between MAX_TR_DYNAMIC_RANGE and bitDepthis used.

In a particular example of a 32×32 DCT matrix, the DCT process will tendto require log₂(32) bits of accuracy over bitDepth, which is how thevalue of bitDepth+5 is derived. However, the quantising process may addthe equivalent of another bit of accuracy.

Significantly better results can be obtained, at least for some videomaterial, if this additional bit is provided as extra accuracy in theDCT process.

However, it has also been found in empirical tests that this problem,and accordingly the solution of using MAX_TR_DYNAMIC_RANGE=bitDepth+6,are relevant only to larger DCT matrix sizes. An advantage of allowingdifferent relationships between MAX_TR_DYNAMIC_RANGE and bitDepth can bethat this avoids unnecessary processing overhead in instances where theadditional accuracy is not required.

In particular, in the present examples, the problem outlined above, andthe proposed solution, are particularly relevant to 32×32 DCT matrixsizes. For smaller matrices, the relationshipMAX_TR_DYNAMIC_RANGE=bitDepth+5 can be used.

More generally, an adaptive variation of the relationship betweenMAX_TR_DYNAMIC_RANGE and bitDepth can be used, so that the offset (thevalue which is added to bitDepth to generate MAX_TR_DYNAMIC_RANGE) isvaried according to the matrix size. So,MAX_TR_DYNAMIC_RANGE=bitDepth+offset, where offset is a function ofmatrix size. In an example, the offset values could be selected asfollows:

Matrix size Offset 32 × 32 +6 all others below 32 × 32 +5

In another example, a progressive relationship could be used so as torecognise the need for more accuracy with higher matrix sizes, while alower accuracy can be used with a smaller matrix size:

Matrix size Offset 32 × 32 +6 16 × 16 +5  8 × 8 +4

The relationship between offset and matrix size should be the same, asbetween the reverse (decoding) path of the encoder, and the decodingpath of a decoder. There is therefore a need to establish or communicatethe relationship, as between these three areas of the technology.

In an example, the relationship can be established as a predetermined,hard-coded relationship at the encoder and decoder.

In another example, the relationship can be explicitly communicated aspart of (or in association with the encoded video data.

In another example, the relationship can be inferred at both the encoderand decoder from the identity of a “profile” associated with the encodedvide data. Here, as discussed elsewhere in this description, a profileis an identification of a set of parameters used for encoding ordecoding the video data. The mapping between a profile identificationand the actual parameters set by that profile identification ispre-stored at both encoder and decoder. The profile identification canbe carried as part of the encoded data, for example.

In general, however, the value offset (referred to in some examples as asecond offset) is dependent upon the matrix size of the transformmatrices.

As with the transform matrix precision, the choice ofMAX_TR_DYNAMIC_RANGE and/or ENTROPY_CODING_DYNAMIC_RANGE could beconfigured by the bit depth of the input data and the profile, oralternately determined by parameters specified at the sequence, pictureor slice level (possibly the same parameters as those that select theDCT matrices).

These arrangements provide examples of frequency-transforming inputimage data to generate an array of frequency-transformed input imagecoefficients by a matrix-multiplication process, according to a maximumdynamic range of the transformed data and using transform matriceshaving a data precision; and selecting the maximum dynamic range and/orthe data precision of the transform matrices according to the bit depthof the input image data.

In embodiments, the data precision of the transform matrices can be setto a first offset number of bits (such as 2) less than the bit depth ofthe input image data; and the maximum dynamic range of the transformeddata can be set to a second offset number of bits (such as 5) greaterthan the bit depth of the input image data.

The entropy coding can be changed to include some fixed-bit processing(see Entropy Coding Embodiments 1 and 2) to increase compression at lowQPs.

The presence of fixed bits could be configured at the sequence level.

The number of fixed bits B_(F) could be configured at the sequence,picture (although this is difficult since the picture parameter set doesnot know of sequence level settings), slice or CU level (possibly bysignalling a delta from the number of fixed bits for the previoussequence/picture/slice/CU, parent entity or profile definition).

The entropy coding can be changed to include CABAC bit-alignment toallow bypass bits to be extracted from the stream without the use oflong division (it may also be preferable to apply one or more of theaforementioned bit-loss mitigation methods).

Embodiments of the present disclosure therefore provide that internalaccuracies be increased to accommodate the requirement in the RangeExtensions mandate to allow for higher bit depths through HEVC. Thevarious sources of error have been studied and recommendations have beenmade. In addition, changes to improve coding efficiency have beenpresented, and changes to improve throughput have also been presented.

Increased-Precision Transform Matrices

This part of the description details the transform matrices at variouslevels of precision.

4×4 DST

The transform matrix is of the form:

$\quad{\begin{matrix}a & b & c & d \\c & c & e & {- c} \\d & {- a} & {- c} & b \\b & {- d} & c & {- a}\end{matrix}}$

where the values in the grid are defined by the matrix coefficientprecision according to the following table (6-bit HEVC version 1 matrixvalues included for comparison):

6-bit 7-bit 8-bit 9-bit 10-bit 11-bit 12-bit 13-bit 14-bit a 29 58 117233 467 934 1868 3736 7472 b 54 110 219 439 878 1755 3510 7021 14042 c73 148 296 591 1182 2365 4730 9459 18919 d 83 168 336 672 1345 2689 537810757 21513 e 0 0 0 0 0 0 0 0 0

Combined DCT Matrix

For ease of implementation, a single 32×32 DCT matrix M₃₂ can bedescribed, from which each smaller N×N DCT matrix M_(N) is derivedthrough subsampling (as an example of deriving transform matrices at arequired data precision from respective source transform matrices at adifferent data precision) according to the following:

M _(N)[x][y]=M ₃₂[x][(2^((5−log 2(N)))) y] for x,y=0 . . . (N−1).

The combined matrix M₃₂ is of the form:

$\quad{\begin{matrix}a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a \\p & q & r & s & t & u & v & w & x & y & z & A & B & C & D & E & {- E} & {- D} & {- C} & {- B} & {- A} & {- z} & {- y} & {- x} & {- w} & {- v} & {- u} & {- t} & {- s} & {- r} & {- q} & {- p} \\h & i & j & k & l & m & n & o & {- o} & {- n} & {- m} & {- l} & {- k} & {- j} & {- i} & {- h} & {- h} & {- i} & {- j} & {- k} & {- l} & {- m} & {- n} & {- o} & o & n & m & l & k & j & i & h \\q & t & w & z & C & {- E} & {- B} & {- y} & {- v} & {- s} & {- p} & {- r} & {- u} & {- x} & {- A} & {- D} & D & A & x & u & r & p & s & v & y & B & E & {- C} & {- z} & {- w} & {- t} & {- q} \\d & e & f & g & {- g} & {- f} & {- e} & {- d} & {- d} & {- e} & {- f} & {- g} & g & f & e & d & d & e & f & g & {- g} & {- f} & {- e} & {- d} & {- d} & {- e} & {- f} & {- g} & g & f & e & d \\r & w & g & {- D} & {- y} & {- t} & {- p} & {- u} & {- z} & {- E} & A & V & q & s & x & C & {- C} & {- x} & {- s} & {- q} & {- v} & {- A} & E & z & u & p & t & y & D & {- B} & {- w} & {- r} \\i & l & o & {- m} & {- j} & {- h} & {- k} & {- n} & n & k & h & j & m & {- o} & {- l} & {- i} & {- i} & {- i} & {- o} & m & j & h & k & n & {- n} & {- k} & {- h} & {- j} & {- m} & o & l & i \\s & z & {- D} & {- w} & {- p} & {- v} & {- C} & A & t & r & y & {- E} & {- x} & {- q} & {- u} & {- B} & B & u & q & x & E & {- y} & {- r} & {- t} & {- A} & C & v & p & w & D & {- z} & {- s} \\b & c & {- c} & {- b} & {- b} & {- c} & c & b & b & c & {- c} & {- b} & {- b} & {- c} & c & b & b & c & {- c} & {- b} & {- b} & {- c} & c & b & b & c & {- c} & {- b} & {- b} & {- c} & c & b \\t & C & {- y} & {- p} & {- x} & D & u & s & B & {- z} & {- q} & {- w} & E & v & r & A & {- A} & {- r} & {- v} & {- E} & w & q & z & {- B} & {- s} & {- u} & {- D} & x & p & y & {- C} & {- t} \\j & o & {- k} & {- i} & {- n} & l & h & m & {- m} & {- h} & {- l} & n & i & k & {- o} & {- j} & {- j} & {- o} & k & i & n & {- l} & {- h} & {- m} & m & h & l & {- n} & {- i} & {- k} & o & j \\u & {- E} & {- t} & {- v} & D & s & w & {- C} & {- r} & {- x} & B & q & y & {- A} & {- p} & {- z} & z & p & A & {- y} & {- q} & {- B} & x & r & C & {- w} & {- s} & {- D} & v & t & E & {- u} \\e & {- g} & {- d} & {- f} & f & d & g & {- e} & {- e} & g & d & f & {- f} & {- d} & {- g} & e & e & {- g} & {- d} & {- f} & f & d & g & {- e} & {- e} & g & d & f & {- f} & {- d} & {- g} & e \\v & {- B} & {- p} & {- C} & u & w & {- A} & {- q} & {- D} & t & x & {- z} & {- r} & {- E} & s & y & {- y} & {- s} & E & r & z & {- x} & {- t} & D & q & A & {- w} & {- u} & C & p & B & {- v} \\k & {- m} & {- i} & o & h & n & {- j} & {- i} & l & j & {- n} & {- h} & {- o} & l & m & {- k} & {- k} & m & i & {- o} & {- h} & {- n} & j & l & {- l} & {- j} & n & h & o & {- l} & {- m} & k \\w & {- y} & {- u} & A & s & {- C} & {- q} & E & p & D & {- r} & {- B} & t & z & {- v} & {- x} & x & v & {- z} & {- t} & B & r & {- D} & {- p} & {- E} & q & C & {- s} & {- A} & u & y & {- w} \\a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a \\x & {- v} & {- z} & t & B & {- r} & {- D} & p & {- E} & {- q} & C & s & {- A} & {- u} & y & w & {- w} & {- y} & u & A & {- s} & {- C} & q & E & {- p} & D & r & {- B} & {- t} & z & v & {- x} \\l & {- j} & {- n} & h & {- o} & {- i} & m & k & {- k} & {- m} & i & o & {- h} & n & j & {- i} & {- i} & j & n & {- h} & o & i & {- m} & {- k} & k & m & {- i} & {- o} & h & {- n} & {- j} & l \\y & {- s} & {- E} & r & {- z} & {- x} & t & D & {- q} & A & w & {- u} & {- C} & p & {- B} & {- v} & v & B & {- p} & C & u & {- w} & {- A} & q & {- D} & t & x & z & {- r} & E & s & {- y} \\f & {- d} & g & e & {- e} & {- g} & d & {- f} & {- f} & d & {- g} & {- e} & e & g & {- d} & f & f & {- d} & g & e & {- e} & {- g} & d & {- f} & f & d & {- g} & {- e} & e & g & {- d} & f \\z & {- p} & A & y & {- q} & B & x & {- r} & C & w & {- s} & D & v & {- t} & E & u & {- u} & {- E} & t & {- v} & {- D} & s & {- w} & {- C} & r & {- x} & {- B} & q & {- y} & {- A} & p & {- z} \\m & {- h} & l & n & {- i} & k & o & {- j} & j & {- o} & {- k} & i & {- n} & {- i} & h & {- m} & {- m} & h & {- l} & {- n} & i & {- k} & {- o} & j & {- j} & o & k & {- i} & n & l & {- h} & m \\A & {- r} & v & {- E} & {- w} & q & {- z} & {- B} & s & {- u} & D & x & {- p} & y & C & {- t} & t & {- C} & {- y} & p & {- x} & {- D} & u & {- s} & B & z & {- q} & w & E & {- v} & r & {- A} \\c & {- b} & b & {- c} & {- c} & b & {- b} & c & c & {- b} & b & c & c & {- b} & b & {- c} & {- c} & b & {- b} & {- c} & {- c} & b & {- b} & c & c & {- b} & b & {- c} & {- c} & b & {- b} & c \\B & {- u} & q & {- x} & E & y & {- r} & t & {- A} & {- C} & v & {- p} & w & {- D} & {- z} & s & {- s} & z & D & {- w} & p & {- v} & C & A & {- t} & r & {- y} & {- E} & x & {- q} & u & {- B} \\n & {- k} & h & {- j} & m & o & {- l} & i & {- i} & l & {- o} & {- m} & j & {- h} & k & {- n} & {- n} & k & {- h} & j & {- m} & {- o} & i & {- i} & i & {- l} & o & m & {- j} & h & {- k} & n \\C & {- x} & s & {- q} & v & {- A} & {- E} & z & {- u} & p & {- t} & y & {- D} & {- B} & w & {- r} & r & {- w} & B & D & {- y} & t & {- p} & u & {- z} & E & A & {- v} & q & {- s} & x & {- C} \\g & {- f} & e & {- d} & d & {- e} & f & {- g} & {- g} & f & {- e} & d & {- d} & e & {- f} & g & g & {- f} & e & {- d} & d & {- e} & f & {- g} & {- g} & f & {- e} & d & {- d} & e & {- f} & g \\D & {- A} & x & {- u} & r & {- p} & s & {- v} & y & {- B} & E & C & {- z} & W & {- t} & q & {- q} & t & {- w} & z & {- C} & {- E} & B & {- y} & v & {- s} & p & {- r} & u & {- x} & A & {- D} \\o & {- n} & m & {- l} & k & {- j} & i & {- h} & h & {- i} & j & {- k} & l & {- m} & n & {- o} & {- o} & n & {- m} & l & {- k} & j & {- i} & h & {- h} & i & {- j} & k & {- l} & m & {- n} & o \\E & {- D} & C & {- B} & A & {- z} & y & {- x} & w & {- v} & u & {- t} & s & {- r} & q & {- p} & p & {- q} & r & {- s} & t & {- u} & v & {- w} & x & {- y} & z & {- A} & B & {- C} & D & {- E}\end{matrix}}$

with the values in the grid defined by the matrix coefficient precisionaccording to the following table (6-bit HEVC version 1 matrix valuesincluded for comparison):

6- 7- 8- 9- 10- 11- 12- 13- 14- bit bit bit bit bit bit bit bit bit a 64128 256 512 1024 2048 4096 8192 16384 b 83 167 334 669 1338 2676 535210703 21407 c 36 69 139 277 554 1108 2217 4433 8867 d 89 178 355 7101420 2841 5681 11363 22725 e 75 151 301 602 1204 2408 4816 9633 19266 f50 101 201 402 805 1609 3218 6436 12873 g 18 35 71 141 283 565 1130 22604520 h 90 180 360 721 1441 2882 5765 11529 23059 i 87 173 346 693 13862772 5543 11086 22173 j 80 160 319 639 1277 2554 5109 10217 20435 k 70140 280 560 1119 2239 4478 8956 17911 l 57 115 230 459 919 1837 36757350 14699 m 43 85 171 341 683 1365 2731 5461 10922 n 25 53 105 210 420841 1682 3363 6726 o 9 18 35 71 142 284 568 1136 2271 p 90 181 362 7231446 2893 5786 11571 23143 q 90 179 358 716 1432 2865 5730 11460 22920 r88 176 351 702 1405 2810 5619 11238 22476 s 85 170 341 682 1364 27275454 10908 21816 t 82 164 327 655 1309 2618 5236 10473 20946 u 78 155311 621 1242 2484 4968 9937 19874 v 73 145 291 582 1163 2326 4653 930518611 w 67 134 268 537 1073 2146 4292 8584 17168 x 61 122 243 486 9731945 3890 7780 15560 y 54 108 216 431 863 1725 3451 6901 13803 z 46 93186 372 745 1489 2978 5956 11912 A 38 77 155 310 619 1238 2477 4953 9907B 31 61 122 244 488 976 1951 3903 7806 C 22 44 88 176 352 704 1407 28155630 D 13 27 53 106 212 425 850 1700 3400 E 4 9 18 36 71 142 284 5681137

For information, the smaller DCT matrices derived from the 32×32 matrixare presented here. The values in each grid are defined by the matrixcoefficient precision according to the above table.

4×4 DCT

The matrix M₄ is defined as the first 4 coefficients of every 8^(th) rowof the combined matrix M₃₂.

$\quad{\begin{matrix}a & a & a & a \\b & c & {- c} & {- b} \\a & {- a} & {- a} & a \\c & {- b} & b & {- c}\end{matrix}}$

8×8 DCT

The matrix M₈ is defined as the first 8 coefficients of every 4^(th) rowof the combined matrix M₃₂.

$\quad{\begin{matrix}a & a & a & a & a & a & a & a \\d & e & f & g & {- g} & {- f} & {- e} & {- d} \\b & c & {- c} & {- b} & {- b} & {- c} & c & b \\e & {- g} & {- d} & {- f} & f & d & g & {- e} \\a & {- a} & {- a} & a & a & {- a} & {- a} & a \\f & {- d} & g & e & {- e} & {- g} & d & {- f} \\c & {- b} & b & {- c} & {- c} & b & {- b} & c \\g & {- f} & e & {- d} & d & {- e} & f & {- g}\end{matrix}}$

16×16 DCT

The matrix M₁₆ is defined as the first 16 coefficients of every even rowof the combined matrix M₃₂.

$\quad{\begin{matrix}a & a & a & a & a & a & a & a & a & a & a & a & a & a & a & a \\h & i & j & k & l & m & n & o & {- o} & {- n} & {- m} & {- l} & {- k} & {- j} & {- i} & {- h} \\d & e & f & g & {- g} & {- f} & {- e} & {- d} & {- d} & {- e} & {- f} & {- g} & g & f & e & d \\i & l & o & {- m} & {- j} & {- h} & {- k} & {- n} & n & k & h & j & m & {- o} & {- l} & {- i} \\b & c & {- c} & {- b} & {- b} & {- c} & c & b & b & c & {- c} & {- b} & {- b} & {- c} & c & b \\j & o & {- k} & {- i} & {- n} & l & h & m & {- m} & {- h} & {- l} & n & i & k & {- o} & {- j} \\e & {- g} & {- d} & {- f} & f & d & g & {- e} & {- e} & g & d & f & {- f} & {- d} & {- g} & e \\k & {- m} & {- i} & o & h & n & {- j} & {- l} & l & j & {- n} & {- h} & {- o} & i & m & {- k} \\a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a & a & {- a} & {- a} & a \\l & {- j} & {- n} & h & {- o} & {- i} & m & k & {- k} & {- m} & i & o & {- h} & n & j & {- l} \\f & {- d} & g & e & {- e} & {- g} & d & {- f} & {- f} & d & {- g} & {- e} & e & g & {- d} & f \\m & {- h} & l & n & {- i} & k & o & {- j} & j & {- o} & {- k} & i & {- n} & {- l} & h & {- m} \\c & {- b} & b & {- c} & {- c} & b & {- b} & c & c & {- b} & b & {- c} & {- c} & b & {- b} & c \\n & {- k} & h & {- j} & m & o & {- l} & i & {- i} & l & {- o} & {- m} & j & {- h} & k & {- n} \\g & {- f} & e & {- d} & d & {- e} & f & {- g} & {- g} & f & {- e} & d & {- d} & e & {- f} & g \\o & {- n} & m & {- l} & k & {- j} & i & {- h} & h & {- i} & j & {- k} & l & {- m} & n & {- o}\end{matrix}}$

Further techniques relating to embodiments of fixed bit encoding orrelated techniques will be discussed with reference to FIGS. 36 and 37.

First, however, techniques used to encode escape codes will bediscussed.

So-called Golomb-Rice coding encodes a value, v, as a unary encodedprefix (a variable number of 1s followed by a 0, or vice versa) followedby k bits of suffix.

Let prefix_length be the total number of Is in the unary encoded prefix.Let K be the value of the least significant k bits.

v=(prefix_length<<k)+K

(where <<n signifies a left shift by n bits; a similar notation >>nrepresents a right shift by n bits)

The total number of bits equals prefix_length+1+k.

Next, so-called exponential Golomb order-k codes will be discussed. Insuch codes, a number to be encoded is split into a variable lengthunary-encoded prefix and a variable length suffix. The number of suffixbits=prefix_length+k. Here, prefix_length is once again the number of 1sin the unary code.

The total number of bits in the code=prefix_length+1+prefix_length+k.

Let K be the value of the last k bits.

When prefix_length is 0, v will be equal to K.

When prefix_length is 1, v will be between (1<<k)+K and (3<<k)+K and(exclusive)

When prefix_length is 2, v will be between (3<<k)+K and (7<<k)+K and(exclusive)

When prefix_length is 3, v will be between (7<<k)+K and (15<<k)+K and(exclusive)

Therefore v=((2̂prefix_length)−1)<<k)+suffix

In HEVC, both Golomb-Rice and Exponential Golomb codes are used. Ifprefix_length is less than three, the code is interpreted as aGolomb-Rice code. However, if the prefix_length is greater than or equalto 3, the code is interpreted as an exponential Golomb code of order k.

The prefix (in either system) is an example of a unary code. The suffixis an example of a non-unary code. The two systems are examples of atwo-part variable length code.

In this case, the value of prefix_length used to decode the exponentialGolomb code is reduced by 3, and the value resulting from the decodingoperation is increased by (3<<k), since this is the smallest value thatcannot be represented using the Golomb-Rice code.

The value “k” used for the HEVC Escape and Escape-Escape codes varies.For each group of 16 coefficients, the value k start at 0, and isincreased whenever the magnitude of a coefficient value is greater than3<<k. In response to this situation, k is incremented (that is to say,in response to a magnitude of a current data value), to a maximum of 4.Note that the discussion relates to coefficient magnitudes, as a signbit representing the sign of a coefficient is sent separately.

FIG. 36 is a schematic flowchart illustrating a process to generateescape codes as discussed above. Several of the flowchart steps aresimilar to those discussed previously and will not be described again indetail.

The method is operable with respect to a group of data values comprising(for example) a sequence of frequency transformed image coefficients, orthe non-zero constituents of that sequence or the non-zero constituentsof that sequence where the magnitude of each data value has been reducedby 1 (in this last case, a significance map may be generated first, sothat each coefficient is reduced by 1 before further processing becausethe significance map accounts for the value of 1).

At a step 2000, an initial value of k is set. In a normal HEVC system, kis initially set to 0. Steps 2010, 2020, 2030, 2040, 2050 and 2060corresponds to similar steps in the flowcharts of FIGS. 29-31 and willnot be discussed further here. Note that in FIGS. 29-31 as well as inFIG. 36, in some example implementations of HEVC, not all of the mapsneed to be generated for each coefficient. For example, within a groupof (say) 16 coefficients, there may be one or more coefficients forwhich some maps are not generated.

At a step 2070, if an escape code is needed, it is generated based on acurrent value of k using the techniques just described. In particular, acoefficient which requires the use of an escape code is first handledusing the significance map and optionally one or more of the other maps.Note that in the case of a coefficient which needs escape coding, any ofthe significance, >1 and >2 maps that are used will be flagged as “1”.This is because any coefficient which requires escape coding is bydefinition greater than a value which can be encoded using whichevermaps are available in respect of that coefficient.

An escape code is needed if the current data value has not been fullyencoded. Here, the term “fully” encoded means that the data value, lessthe values already encoded (by the maps, or the maps plus the fixedbits, for example) is zero. In other words, a data value is fullyencoded by components already generated if the residual amount of thatdata value, taking those components into account, is zero.

So, assuming that for an example coefficient, a significance map and >1and >2 maps are available, each of these will be flagged as“significant”, “>1” and “>2” in respect of that coefficient.

This means (in this example) that the coefficient must be at least 3.

Therefore, the value of 3 can be subtracted from the coefficient beforeescape coding, with no loss of information. The value of 3 (or moregenerally, a variable base_level which indicates the numerical rangewhich is defined by the maps which apply to that coefficient) isreinstated at decoding.

Taking a coefficient value of 15 decimal (1111 binary) as an example,the significance map is “1”, the >1 map is “1” and the >2 map is “1”.The value base_level is 3. Base_level is subtracted from the coefficientvalue to give a value of 12 decimal (1100 binary) which is passed forescape coding.

The value k (see above) now defines the number of suffix bits. thesuffix bits are taken from the least significant bits of the coefficientvalue after the subtraction of base_level. If (for example) k=2, thenthe two least significant bits of the remaining value 1100 are treatedas suffix bits, which is to say that the suffix bits in this example are00. The remaining bits (11 in this example) are handled encoded as aprefix.

So in summary, the processing associated with an escape code involves:

generating one or more maps defining one or more least significant bitsof a coefficient so that (if an escape code is required) the coefficientmust have a value of at least base_level;

subtracting base_level from the coefficient;

encoding the least significant k bits of the remaining part of thecoefficient as suffix bits; and

encoding the remaining most significant bits of the remaining part ofthe coefficient as a prefix.

Then, using the test described above, if the value of k needs to bechanged, the change is implemented at a step 2080 and the new value of kis provided for the next operation of the step 2070.

A modification to the escape code technique which can provide a similareffect to the user of fixed bits (FIGS. 30 and 31) is to apply an offsetto the value k defining the number of suffix bits used in an escapecode.

For example, the value k in a HEVC system has a range of 0 to 4, and thetransition (in respect of a group of coefficients) from a starting pointof 0 up to a maximum value of 4. In embodiments of the presenttechnique, an offset is added to this value of k. For example, theoffset may be predetermined as a value param_offset, such as 3, so thatthe existing technique for varying k in the course of coding a group ofcoefficients will, instead of varying k from k=0 to k=4, vary it fromk=param_offset to k=4+param_offset.

The value param_offset can be predetermined as between encoder anddecoder.

Or the value param_offset can be communicated from the encoder anddecoder, for example as part of a stream, picture, slice or block (suchas TU) header.

Or the value param_offset can be derived at the encoder and the decoderas a predetermined function of the bit depth of the video data, such as(for example):

-   -   for bit_depth≤10, param_offset=0    -   for bit_depth>10, param_offset=bit_depth−10

Or the value param_offset can be derived at the encoder and the decoderas a predetermined function of the degree of quantisation (Qp)applicable to a block or group of coefficients;

Or the value param_offset can be dependent (for example, in apredetermined manner) upon one or more of which video component is beingencoded, on block size, on mode (for example, lossless or lossy), onpicture type and so on.

Or the value param_offset can be derived at the encoder and the decoderon an adaptive basis, taking a predetermined starting point, or astarting point communicated in a header, or a starting point derivedfrom (for example) bit_depth. An example of such an adaptive processwill be discussed below with reference to FIG. 37.

Or more than one of these criteria could apply. In particular, where thevalue param_offset is dependent upon another parameter (such as blocksize) and is adaptively varied as in FIG. 37 below, then the adaptivevariation could be applied separately to each possible value ofparam_offset (that is, separately for each block size).

Note that any or all of these dependencies could apply in respect of thenumber of fixed bits used in the arrangements of FIGS. 30 and 31.

Comparing this modified technique and the fixed bits techniquesdiscussed above with relation to FIGS. 30 and 31, it can be seen that:

(a) in the fixed bits technique of FIGS. 30 and 31, a coefficient issplit into more significant and less significant portions before thegeneration of any of the maps, one or more maps are then generated fromthe more significant portion, and the less significant portion isdirectly encoded (or otherwise treated as discussed above); but

(b) in the generation of escape codes using param_offset, the one ormore maps are generated first, and then the remaining part of thecoefficient value (less the value base_level) is handled either as asuffix or a prefix, with the boundary between suffix and prefixdepending on k+param_offset, and with the suffix representing the leastsignificant bit(s) of the remaining portion.

In either instance, the parameter(s) associated with the fixed bitencoding, or the value param_offset, can be varied in an adaptivemanner. An example of how this can be achieved will now be discussedwith reference to FIG. 37. In FIG. 37, similar techniques can apply toeither the number of fixed bits (referred to as “NFB” in FIG. 37, anddenoting the number of bits of the least significant portion derived atthe step 1625 or 1725 of FIGS. 30 and 31 respectively) or the valueparam_offset (shortened to “offset” in FIG. 37) from the discussionabove.

In the following discussion of an example arrangement, it is assumedthat the adaptation of the offset or NFB value is carried out on aslice-by-slice basis. Note that a slice can be defined within the HEVCfamily of systems as anything from one LCU up to a whole picture, but afundamental feature of a slice is that its encoding is independent ofthe encoding applies to any other slice, so that an individual slice canbe decoded without reference to another slice. Of course, however, theadaptation could take place on a block-by-block or a picture-by-picturebasis.

Note that the process of FIG. 37 takes place at the encoder and also, ina complimentary decoding form, takes place at the decoder, so that thevalue of the offset/NFB variable tracks identically as between theencoder and the decoder.

At a step 2100, the processing of a slice is commenced.

At a step 2110, the offset/NFB value is reset. This could involveresetting the value to a fixed value such as 0. In an alternativearrangement, the value could be reset to a starting value derived fromthe final value of the offset/NFB variable in respect of one or moreprevious slices. In such a case, in order to maintain the ability todecode each slice independently, embodiments of the present technologyprovide an indication of the starting value of the offset/NFB variablein the slice header. Note that various different techniques forobtaining such a starting value are available. For example, the startingvalue of the offset/NFB variable could be set to 0 if the final value ofthat variable for the previous slice did not exceed 2, and could be setto 1 otherwise. A similar arrangement could be applied to an averagefinal value of the variable obtained from all slices relating to apreceding picture. The skilled person will appreciate that various otherpossibilities are available. Of course, if a predetermined startingvalue is used, then either this can be agreed in advance by a standarddefinition applicable to the encoder and the decoder, or thepredetermined starting value can be specified in a stream or pictureheader.

With regards to header data, a flag may be included within a stream,picture or slice header to indicate whether the adaptation process ofFIG. 37 is to take place in respect of that stream, picture or slice.

At a step 2120, processing of the first transform unit (TU) is started.The processing of a slice proceeds on a TU by TU basis as discussedearlier.

At a step 2130 three more variables are reset, this time to 0. Thesevariables are referred to as under, over and total. The purpose of thesevariables will be discussed below.

Within a TU, each coefficient is encoded in turn. At a step 2140, a nextcoefficient is encoded. The encoding of the coefficient may follow theflow chart of FIGS. 30/31 or the flowchart of FIG. 36, in each casemaking use of the offset or NFB value applicable at that stage in theprocess. Of course, for the first coefficient to be encoded, theoffset/NFB value is equal to that set at the step 2110. For latercoefficients, the current value of offset/NFB is used.

A test is applied in respect of the outcome of the encoding of the step2140. Depending on the outcome of the test, control passes to a step2150, 2160 or 2170 or directly to a step 2180. First, the test will bedescribed. Note that the test is slightly different depending on whetherthe fixed bits system of FIGS. 30/31 or the param_offset system of FIG.37 and accompanying discussion is used.

Fixed Bits Test

In the case of the fixed bits system, whenever a set of fixed bits isencoded (whenever the step 1655 or the step 1755 is executed), then thevariable “total” is incremented. Accordingly, the variable “total”refers to the number of occasions, since the variable was last reset, atwhich fixed bits have been encoded.

The test then derives a variable remaining_magnitude, which is definedas the part of the coefficient magnitude that is not being encoded asfixed bits, so that:

remaining_magnitude=(magnitude−1)>>NFB

Another value, base_level, is defined (as discussed above) as thehighest magnitude that could be described without the use of an escapecode. Here, it is noted that a particular coefficient may have one, twoor three flags or map entries encoded in respect of that coefficient.So:

if the coefficient had a >2 flag, base_level=3; else

if the coefficient had a >1 flag, base_level=2; else

base_level=1

The value remaining_magnitude is then tested against base_level.

If ((remaining_magnitude>>1)≥base_level) then the variable “under” isincremented. In FIG. 37, this corresponds to the step 2150. Theunderlying meaning of this step is that a so-called undershoot has beendetected such that the number of fixed bits (NFB) was not enough toencode the current coefficient. The significance of the right shift(>>1) in the test is that the undershoot is only flagged as a noteworthyundershoot if the variable NFB is insufficient by two or more bits.

Similarly, if ((NFB>0) A/VD ((remaining_magnitude<<1)≤0)), then thevariable “over” is incremented. In FIG. 37, this corresponds to the step2160. The underlying meaning of this step is that an overshoot isdetected if, even with one fewer fixed bit (detected by the <<1 shift inthe expression given above), the fixed bit component would have beencapable of encoding the entire magnitude of the coefficient. In otherwords, the number of fixed bits is significantly in excess of the numberrequired to encode that coefficient.

It will be understood that the various parameters used in these tests,in particular the number of bit shifts applied, can be varied accordingto the design skill of the notional skilled person.

If neither the undershoot nor the overshoot test is fulfilled, but fixedbits are encoded, then control passes to the step 2170 at which only thevariable total is incremented.

For completeness, it is noted that control passes directly to the step2180 of FIG. 37 where fixed bit operation is not enabled, so that nochanges made to any of the variables: under, over and total.

Param_Offset Test

In the case of a system based on param_offset, the underlying principlesare similar but some of the details are little different to thosediscussed above.

The variable “total” is incremented whenever an escape value is encoded.

The coefficient value is tested against the parameter k which, asdiscussed above, is defined so as to take into account the effect of theoffset param_offset.

If (coefficient>(3<<k)) then the variable “under” is incremented. Thiscorresponds to the step 2150 of FIG. 37 and indicates an undershootsituation as discussed above. In other words, the variable k, takinginto account param_offset, was insufficient to encode the escape code asa suffix.

Otherwise, if ((coefficient*3)<(1<<k)) then the variable “over” isincremented. This corresponds to the step 2160 of FIG. 37. Thisrepresents an overshoot situation in which the variable k, taking intoaccount param_offset, provided more suffix bits that were required toencode the escape code.

If neither the undershoot nor the overshoot test is fulfilled, but anescape code is encoded, then control passes to the step 2170 at whichonly the variable total is incremented.

Again, it is noted that control passes directly to the step 2180 of FIG.37 where an escape code is not encoded, so that no changes made to anyof the variables: under, over and total.

Note that in either set of tests, it is checked whether the undershootor overshoot is significant by checking whether the undershoot orovershoot would have happened if NFB or param_offset had been evenhigher or even lower respectively. But this extra margin is notrequired—the tests could simply be “did an under (over) shoot happen?”

At a step 2180, if there is another coefficient available for encodingin that TU, then control returns to the step 2140. Otherwise, controlpasses to a step 2190 which is performed at the end of each TU, butbefore the next TU is encoded. At this step 2190, the variableoffset/NFB is potentially adaptively changed according to the variablesunder, over and total. Here, the same adaptation applies to either theoffset value or the NFB value, so that:

if ((under*4)>total, the offset/NFB value is incremented (by 1); and

if ((over*2)>total, the offset/NFB value is decremented (by 1) subjectto a minimum value of 0.

Note that if both tests are passed in respect of a single TU, then thevalue of NFB or param_offset will remain the same.

Note that the division by slices and then by TUs is not essential—anygroup of values (which may even not be video data values) can be treatedin this way, and subdivided into subsets in place of the TU division inthis description.

This is equivalent to incrementing the offset/NFB if more than 25% ofundershoots are experienced, but decrementing the offset/NFB value ifthere are more than 50% of overshoots. So the proportion used for thetest of undershoots is lower than the proportion used for the test ofovershoots. A reason for this asymmetry is that undershoots generatemore inefficiency than overshoots because of the nature of the escapecoding methods used in the case of undershoots. It will be appreciatedhowever that the same thresholds could be used, or different valuescould be used.

Finally, at a step 2200, if there is another TU in the slice thencontrol returns to the step 2120. If there are no further TUs in theslice then control returns to the step 2100. Note that, as discussedabove, optionally the starting point for offset/NFB could be set (foruse in the next instance of the step 2120, for the next or a futureslice) based on the results obtained during the encoding process whichhas just completed.

Complementary steps are carried out at the decoding side (or at thedecoding path of an encoder). For example, a decoding method cancomprise decoding a first portion of each data value from one or moredata sets indicative of first portions of predetermined magnitude rangesand encoded to an input data stream using binary encoding; decoding asecond portion of at least those data values not fully encoded by thedata sets, the number of bits of the second portion depending upon avalue n, where n is an integer, data defining the second portion beingincluded in the input data stream and, if a data value has not beenfully decoded by the respective first and second portions, decoding aremaining third portion of the data value from the input data stream;detecting, for a subset of two or more of the data values, (i) a numberof instances of data values for which a third portion has been encodedand would still have been required had a higher value of n been used,and (ii) a number of instances of data values for which a second portionhas been encoded but the value of n was such that the data value couldhave been fully encoded by first and second portions using a lower valueof n; and after decoding the subset of the data values, varying n foruse in respect of subsequent data values according to the results of thedetecting step.

The steps described above can be carried out by the entropy encoder 370and the entropy decoder 410 (in the case of an encoding process) or justby the entropy decoder 410 (in the case of a decoding process). Theprocesses may be implemented in hardware, software, programmablehardware or the like. Note that the entropy encoder 370 can thereforeact as an encoder, a generator, a detector and a processor to implementthe encoding techniques. The entropy decoder 410 can accordingly act asone or more decoders, a detector, and a processor to implement thedecoding techniques described here.

Accordingly, the arrangements described above represent examples of adata decoding method for decoding a group (for example, a slice) of datavalues (for example, image data), the method comprising the steps of:

decoding a first portion of each data value from one or more data sets(for example, maps) indicative of first portions of predeterminedmagnitude ranges and encoded to an input data stream using binaryencoding;

decoding a second portion of at least those data values not fullyencoded by the data sets, the number of bits of the second portiondepending upon a value n, where n is an integer, data defining thesecond portion being included in the input data stream and, if a datavalue has not been fully decoded by the respective first and secondportions, decoding a remaining third portion of the data value from theinput data stream (here, for example, the second portion may representthe fixed bits or a suffix portion; the value n can represent the numberof fixed bits or the suffix length (in Golomb-Rice encoding) or theorder of the exponential Golomb encoding as discussed above; the thirdportion can represent a prefix in the Golomb-Rice or exponential Golombsystems, or an escape code in the fixed bits example);

detecting, for a subset of two or more of the data values, (i) a number(for example, the variable “under”) of instances of data values forwhich a third portion has been encoded and would still have beenrequired had a higher value of n been used, and (ii) a number (forexample, the variable “under”) of instances of data values for which asecond portion has been encoded but the value of n was such that thedata value could have been fully encoded by first and second portionsusing a lower value of n; and

after decoding the subset of the data values, varying (for example,incrementing or decrementing) n for use in respect of subsequent datavalues according to the results of the detecting step.

The variable “total” represents an example of a detected total number ofinstances, in respect of that subset of data values, for which a secondportion was encoded.

The above embodiments also represent an example of a data encodingmethod for encoding an array of data values as data sets and escapecodes for values not encoded by the data sets, an escape code comprisinga unary coded portion and a non-unary coded portion, the methodcomprising the steps of:

setting a coding parameter (param_offset, for example) defining aminimum number of bits of a non-unary coded portion (in Golomb-Rice orexponential Golomb, k defines a minimum suffix length or order), thecoding parameter being between 0 and a predetermined upper limit;

adding an offset value (param_offset in the examples) of 1 or more tothe coding parameter so as to define a minimum least significant dataportion size;

generating one or more data sets (for example, the significancemap, >1, >2 sets) indicative of positions, relative to the array of datavalues, of data values of predetermined magnitude ranges, so as toencode the value of at least one least significant bit of each datavalue;

generating, from at least the part of each data value not encoded by theone or more data sets, respective complementary most-significant dataportions and least-significant data portions, such that themost-significant data portion of a value represents zero or more mostsignificant bits of that portion, and the respective least-significantdata portion is dependent upon a number of least significant bits ofthat part, the number of least significant bits being greater than orequal to the minimum least significant data portion size;

encoding the data sets to an output data stream (for example, as binaryencoded data);

encoding the most significant data portions to the output data stream(for example, as a prefix); and

encoding the least-significant portions to the output data stream (forexample, as a suffix).

Note that the above processes can be carried out (in some embodiments)after the generation of the significance map, so that the data values(on which the process is performed) may be generated from respectiveinput values by: generating a further data set, the further data setbeing a significance map indicative of positions, relative to the arrayof input values, of non-zero input values; and subtracting 1 from eachinput value to generate a respective data value.

FIGS. 38 and 39 are schematic flowcharts illustrating a process forselecting transform dynamic range and data precision parameters.

Referring to FIG. 38, and as described above, at a step 2410 parameterssuch as the maximum dynamic range and/or the data precision of thetransform matrices are selected according to the bit depth of each imageor video component. At a step 2410, for input or output image datahaving image or video components of different bit depths, a single setof the maximum dynamic range and/or the data precision of the transformmatrices is selected for use with all of the image or video components.

Referring to FIG. 39, a step 2420 is similar to the step 2410 butincludes the further features that the single set of the maximum dynamicrange and/or the data precision of the transform matrices is selected asthose values relating to that one of the image or video componentshaving the greatest bit depth.

Embodiments of the disclosure may operate with respect to a sequence ofinput data values dependent upon an array of frequency-transformed inputimage coefficients.

Embodiments as discussed above are defined by the following numberedclauses:

1. A data encoding method for encoding a sequence of data values, themethod comprising the steps of:

generating, from the input data values, respective complementarymost-significant data portions and least-significant data portions, suchthat the most-significant data portion of a value represents a pluralityof most significant bits of that value, and the respectiveleast-significant data portion represents the remaining leastsignificant bits of that value;

generating one or more data sets indicative of positions, relative tothe array of the values, of most-significant data portions ofpredetermined magnitudes;

encoding the data sets to an output data stream using binary encoding;and

including data defining the less-significant portions in the output datastream.

2. A method according to clause 1, in which one of the data sets is asignificance map indicative of positions, relative to an array of thedata values, of most-significant data portions which are non-zero.3. A method according to clause 2, in which the significance mapcomprises a data flag indicative of the position, according to apredetermined ordering of the array of values, of the last of themost-significant data portions having a non-zero value.4. A method according to clause 2 or clause 3, in which the data setscomprise:

a greater-than-one map indicative of positions, relative to the array ofthe values, of most-significant data portions which are greater than 1;and

a greater-than-two map indicative of positions, relative to the array ofthe values, of most-significant data portions which are greater than 2.

5. A method according to clause 1, in which the data sets comprise:

a greater-than-one map indicative of positions, relative to an array ofthe values, of most-significant data portions which are greater than orequal to 1; and

a greater-than-two map indicative of positions, relative to the array ofthe values, of most-significant data portions which are greater than orequal to 2.

6. A method according to clause 5, comprising the step of generating afurther data set, the further data set being a significance mapindicative of positions, relative to the array of the values, ofnon-zero values.7. A method according to clause 6, in which the significance mapcomprises a data flag indicative of the position, according to apredetermined ordering of the array of values, of the last of the valueshaving a non-zero value.8. A method according to any one of the preceding clauses, in which thestep of including data defining the less-significant data portions inthe output data stream comprises encoding the least-significant dataportions using arithmetic coding in which symbols representing theleast-significant data portions are encoded according to respectiveproportions of a coding value range, in which the respective proportionsof the coding value range for each of the symbols that describe theleast-significant data portion are of equal size.9. A method according to any one clauses 1 to 7, in which the step ofincluding data defining the less-significant portions in the output datastream comprises directly including the least-significant data portionsin the output data stream as raw data.10. A method according to any one of the preceding clauses, in which:

the sequence of data values represent image data having an image databit depth; and

the method comprises setting the number of bits to be used as theplurality of most significant bits in each most-significant data portionto be equal to the image data bit depth.

11. A method according to any one of the preceding clauses, in which thesequence of data values comprises a sequence of frequency transformedimage coefficients.12. A method according to clause 11, in which the frequency-transformedinput image coefficients are quantised frequency-transformed input imagecoefficients according to a variable quantisation parameter selectedfrom a range of available quantisation parameters, the methodcomprising:

encoding the array of frequency-transformed input image coefficientsaccording to the most-significant data portions and theleast-significant data portions for coefficients produced using aquantisation parameter in a first predetermined sub-range of the rangeof available quantisation parameters; and

for coefficients produced using a quantisation parameter not in thefirst predetermined sub-range of the range of available quantisationparameters, encoding the array of frequency-transformed input imagecoefficients such that the number of bits in each most-significant dataportion equals the number of bits of that coefficient and the respectiveleast-significant data portion contains no bits.

13. A method according to clause 11 or clause 12, comprising the stepsof:

frequency-transforming input image data to generate an array offrequency-transformed input image coefficients by amatrix-multiplication process, according to a maximum dynamic range ofthe transformed data and using transform matrices having a dataprecision; and

selecting the maximum dynamic range and/or the data precision of thetransform matrices according to the bit depth of the input image data.

14. A method according to clause 13, in which the selecting stepcomprises:

setting the data precision of the transform matrices to a first offsetnumber of bits less than the bit depth of the input image data; and

setting the maximum dynamic range of the transformed data to a secondoffset number of bits greater than the bit depth of the input imagedata.

15. A method according to clause 14, in which the first offset number ofbits is equal to 2 and the second offset number of bits is equal to 5.16. A method according to any one of clauses 13 to 15, comprising thestep of:

deriving transform matrices at a required data precision from respectivesource transform matrices at a different data precision.

17. A method according to any one of the preceding clauses, in which theencoding step comprises:

selecting one of a plurality of complementary sub-ranges of a set ofcode values according to the value of a current input data value of adata set for encoding, the set of code values being defined by a rangevariable;

assigning the current input data value to a code value within theselected sub-range;

modifying the set of code values in dependence upon the assigned codevalue and the size of the selected sub-range;

detecting whether the range variable defining the set of code values isless than a predetermined minimum size and if so, successivelyincreasing the range variable so as to increase the size of the set ofcode values until it has at least the predetermined minimum size; andoutputting an encoded data bit in response to each such size-increasingoperation; and

after encoding a group of input data values, setting the range variableto a value selected from a predetermined subset of available rangevariable values, each value in the subset having at least one leastsignificant bit equal to zero.

18. A method according to clause 17, in which:

the proportions of the sub-ranges relative to the set of code values aredefined by a context variable associated with the input data value.

19. A method according to clause 18, comprising the step of:

following the coding of a data value, modifying the context variable,for use in respect of a next input data value, so as to increase theproportion of the set of code values in the sub-range that was selectedfor the current data value.

20. A method according to any one of clauses 17 to 19, in which:

the set of code values comprises values from 0 to an upper value definedby the range variable, the upper value being between 256 and 510.

21. A method according to clause 20, in which:

the subset of available values of the range variable comprises the value256.

22. A method according to clause 20, in which:

the subset of available values comprises a set consisting of 256 and384;

the step of setting the range variable comprises selecting a value fromthe subset according to a current value of the range variable, so thatthe range variable is set to 256 if the current value of the rangevariable is between 256 and 383, and the range variable is set to 384 ifthe current value of the range variable is between 384 and 510.

23. A method according to clause 20, in which:

the subset of available values comprises a set consisting of 256, 320,384 and 448;

the step of setting the range variable comprises selecting a value fromthe subset according to a current value of the range variable, so thatthe range variable is set to 256 if the current value of the rangevariable is between 256 and 319, the range variable is set to 320 if thecurrent value of the range variable is between 320 and 383, the rangevariable is set to 384 if the current value of the range variable isbetween 384 and 447, and the range variable is set to 448 if the currentvalue of the range variable is between 448 and 510.

24. A method according to any one of clauses 17 to 23, comprising:

encoding data representing values which are not represented in a dataset as bypass data;

detecting the quantity of bypass data associated with a current array;and

applying the setting step if the quantity of bypass data exceeds athreshold amount, but not applying the setting step otherwise.

25. A method according to any one of clauses 17 to 24, in which the dataare encoded as transform units comprising a plurality of arrays of datavalues, the method comprising applying the setting step at the end ofencoding a transform unit.26. A method of encoding image data, comprising the steps of:

frequency-transforming input image data to generate an array offrequency-transformed input image coefficients by amatrix-multiplication process, according to a maximum dynamic range ofthe transformed data and using transform matrices having a dataprecision; and

selecting the maximum dynamic range and/or the data precision of thetransform matrices according to the bit depth of the input image data.

27. Image data encoded by the encoding method of any one of thepreceding clauses.28. A data carrier storing video data according to clause 17.29. A data decoding method for decoding data to provide an array of datavalues, the method comprising the steps of:

separating, from an input data stream, least-significant data portionsof the data values and one or more encoded data sets;

decoding the data sets to generate most-significant data portions of thedata values using binary decoding; and

combining the most-significant data portions and the least-significantdata portions to form the data values, such that, for a data value, therespective most-significant data portion represent a plurality of mostsignificant bits of that data value, and the respectiveleast-significant data portion represents the remaining leastsignificant bits of that data value.

30. A method of decoding image data, comprising the steps of:

frequency-transforming input frequency-transformed image data togenerate array of output image data by a matrix-multiplication process,according to a maximum dynamic range of the transformed data and usingtransform matrices having a data precision; and

selecting the maximum dynamic range and/or the data precision of thetransform matrices according to the bit depth of the output image data.

31. Computer software which, when executed by a computer, causes thecomputer to carry out the method of any one of the preceding clauses.32. A non-transitory machine-readable storage medium on which computersoftware according to clause 31 is stored.33. Data encoding apparatus for encoding a sequence of data values, theapparatus comprising:

a generator configured to generate, from the input data values,respective complementary most-significant data portions andleast-significant data portions, such that the most-significant dataportion of a value represents a plurality of most significant bits ofthat value, and the respective least-significant data portion representsthe remaining least significant bits of that value and configured togenerate one or more data sets indicative of positions, relative to thearray of the values, of most-significant data portions of predeterminedmagnitudes; and

an encoder configured to encoding the data sets to an output data streamusing binary encoding and to include data defining the less-significantportions in the output data stream.

34. Data encoding apparatus for encoding image data, the apparatuscomprising:

a frequency transformer configured to frequency-transform input imagedata to generate an array of frequency-transformed input imagecoefficients by a matrix-multiplication process, according to a maximumdynamic range of the transformed data and using transform matriceshaving a data precision; and

a selector configured to select the maximum dynamic range and/or thedata precision of the transform matrices according to the bit depth ofthe input image data.

35. Data decoding apparatus for decoding data to provide an array ofdata values, the apparatus comprising the steps of:

a data separator configured to separate, from an input data stream,least-significant data portions of the data values and one or moreencoded data sets;

a decoder configured to decode the data sets to generatemost-significant data portions of the data values using binary decoding;and

a combiner configured to combine the most-significant data portions andthe least-significant data portions to form the data values, such that,for a data value, the respective most-significant data portion representa plurality of most significant bits of that data value, and therespective least-significant data portion represents the remaining leastsignificant bits of that data value.

36. Image data decoding apparatus comprising:

a frequency transformed configured to frequency-transform inputfrequency-transformed image data to generate array of output image databy a matrix-multiplication process, according to a maximum dynamic rangeof the transformed data and using transform matrices having a dataprecision; and

a selector configured to select the maximum dynamic range and/or thedata precision of the transform matrices according to the bit depth ofthe output image data.

37. Video data capture, transmission, display and/or storage apparatuscomprising apparatus according to any one of clauses 33 to 36.

Further embodiments are defined by the following numbered clauses:

1. A method of data encoding input data values of a data set forencoding, the method comprising the steps of:

selecting one of a plurality of complementary sub-ranges of a set ofcode values according to the value of a current input data value, theset of code values being defined by a range variable;

assigning the current input data value to a code value within theselected sub-range;

modifying the set of code values in dependence upon the assigned codevalue and the size of the selected sub-range;

detecting whether the range variable defining the set of code values isless than a predetermined minimum size and if so, successivelyincreasing the range variable so as to increase the size of the set ofcode values until it has at least the predetermined minimum size; andoutputting an encoded data bit in response to each such size-increasingoperation; and

after encoding a group of input data values, setting the range variableto a value selected from a predetermined subset of available rangevariable values, each value in the subset having at least one leastsignificant bit equal to zero.

2. A method according to clause 1, in which:

the proportions of the sub-ranges relative to the set of code values aredefined by a context variable associated with the input data value.

3. A method according to clause 2, comprising the step of:

following the coding of an input data value, modifying the contextvariable, for use in respect of a next input data value, so as toincrease the proportion of the set of code values in the sub-range thatwas selected for the current input data value.

4. A method according to any one of clauses 1 to 3, in which:

the set of code values comprises values from 0 to an upper value definedby the range variable, the upper value being between the predeterminedminimum size and a second predetermined values.

5. A method according to clause 4, in which the predetermined minimumsize is 256 and the second predetermined value is 510.6. A method according to any one of clauses 1 to 5, in which;

the subset of available values of the range variable comprises thepredetermined minimum size.

7. A method according to any one of clauses 1 to 5, in which the subsetcomprises two or more values between the predetermined minimum size andthe second predetermined value.8. A method according to clause 7, in which the setting step comprisesselecting a value from the subset according to a current value of therange variable.9. A method according to clause 8, in which the setting step comprisesselecting a particular value from the subset if the current value of therange variable is between that particular value and one less than anext-higher value in the subset.10. A method according to any one of the preceding clauses, comprising:

encoding data representing coefficients which are not represented a dataset as bypass data;

detecting the quantity of bypass data associated with a current array;and

applying the setting step if the quantity of bypass data exceeds athreshold amount, but not applying the setting step otherwise.

11. A method according to any one of the preceding clauses, in which:

the input data values represent image data;

the image data are encoded as transform units comprising a plurality ofarrays of coefficients, the method comprising applying the setting stepat the end of encoding a transform unit.

12. Data encoded by the encoding method of any one of the precedingclauses.13. A data carrier storing video data according to clause 12.14. Data encoding apparatus for encoding input data values of a data setfor encoding, the apparatus comprising:

a selector configured to select one of a plurality of complementarysub-ranges of a set of code values according to the value of a currentinput data value, the set of code values being defined by a rangevariable and to assign the current input data value to a code valuewithin the selected sub-range;

a modifier configured to modify the set of code values in dependenceupon the assigned code value and the size of the selected sub-range;

a detector configured to detect whether the range variable defining theset of code values is less than a predetermined minimum size and if so,to successively increase the range variable so as to increase the sizeof the set of code values until it has at least the predeterminedminimum size; and outputting an encoded data bit in response to eachsuch size-increasing operation; and

a range variable setter configured, after encoding a group of input datavalues, to set the range variable to a value selected from apredetermined subset of available range variable values, each value inthe subset having at least one least significant bit equal to zero.

15. Video data capture, transmission and/or storage apparatus comprisingapparatus according to clause 14.

Further embodiments are defined by the following numbered clauses:

1. A data encoding method for encoding an array of data values, themethod comprising the steps of:

generating, from the input data values, respective complementarymost-significant data portions and least-significant data portions, suchthat the most-significant data portion of a value represents a pluralityof most significant bits of that value, and the respectiveleast-significant data portion is dependent upon the remaining leastsignificant bits of that value;

generating one or more data sets indicative of positions, relative tothe array of the values, of most-significant data portions ofpredetermined magnitude ranges;

encoding the data sets to an output data stream using binary encoding;and

including data defining the least-significant portions in the outputdata stream.

2. A method according to clause 1, in which one of the data sets is asignificance map indicative of positions, relative to an array of thedata values, of most-significant data portions which are non-zero.3. A method according to clause 2, in which the significance mapcomprises a data flag indicative of the position, according to apredetermined ordering of the array of data values, of the last of themost-significant data portions having a non-zero value.4. A method according to clause 2 or clause 3, in which the data setscomprise:

a greater-than-one map indicative of positions, relative to the array ofthe data values, of most-significant data portions which are greaterthan 1; and

a greater-than-two map indicative of positions, relative to the array ofthe data values, of most-significant data portions which are greaterthan 2.

5. A method according to clause 1, in which the data sets comprise:

a greater-than-one map indicative of positions, relative to an array ofthe data values, of most-significant data portions which are greaterthan or equal to 1; and

a greater-than-two map indicative of positions, relative to the array ofthe data values, of most-significant data portions which are greaterthan or equal to 2.

6. A method according to clause 5, comprising the step of generating thedata values from respective input values by:

generating a further data set, the further data set being a significancemap indicative of positions, relative to the array of input values, ofnon-zero input values; and

subtracting 1 from each input value to generate a respective data value.

7. A method according to clause 5 or clause 6, in which the significancemap comprises a data flag indicative of the position, according to apredetermined ordering of the array of input values, of the last of theinput values having a non-zero value.8. A method according to any one of the preceding clauses, in which thestep of including data defining the least-significant data portions inthe output data stream comprises encoding the least-significant dataportions using arithmetic coding in which symbols representing theleast-significant data portions are encoded according to respectiveproportions of a coding value range, in which the respective proportionsof the coding value range for each of the symbols that describe theleast-significant data portion are of equal size.9. A method according to any one of clauses 1 to 8, in which the step ofincluding data defining the least-significant portions in the outputdata stream comprises directly including the least-significant dataportions in the output data stream as raw data.10. A method according to any one of the preceding clauses, in which:

the sequence of data values represent image data having an image databit depth; and

the method comprises setting the number of bits to be used as theplurality of most significant bits in each most-significant data portionto be equal to the image data bit depth.

11. A method according to any one of the preceding clauses, in which thesequence of data values represents a sequence of frequency transformedimage coefficients.12. A method according to clause 11, in which the frequency-transformedinput image coefficients are quantised frequency-transformed input imagecoefficients according to a variable quantisation parameter selectedfrom a range of available quantisation parameters, the methodcomprising:

encoding the array of frequency-transformed input image coefficientsaccording to the most-significant data portions and theleast-significant data portions for coefficients produced using aquantisation parameter in a first predetermined sub-range of the rangeof available quantisation parameters; and

for coefficients produced using a quantisation parameter not in thefirst predetermined sub-range of the range of available quantisationparameters, encoding the array of frequency-transformed input imagecoefficients such that the number of bits in each most-significant dataportion equals the number of bits of that coefficient and the respectiveleast-significant data portion contains no bits.

13. A method according to clause 11, comprising the steps of:

frequency-transforming input image data to generate an array offrequency-transformed input image coefficients by amatrix-multiplication process, according to a maximum dynamic range ofthe transformed data and using transform matrices having a dataprecision; and

selecting the maximum dynamic range and/or the data precision of thetransform matrices according to the bit depth of the input image data.

14. A method according to clause 13, in which the selecting stepcomprises:

setting the data precision of the transform matrices to a first offsetnumber of bits less than the bit depth of the input image data; and

setting the maximum dynamic range of the transformed data to a secondoffset number of bits greater than the bit depth of the input imagedata.

15. A method according to clause 14, in which the first offset number ofbits is equal to 2 and the second offset number of bits is equal to 5.16. A method according to clause 14, in which the first offset number ofbits is equal to 2 and the second offset number of bits is equal to 6.17. A method according to clause 14, in which the second offset numberis dependent upon the matrix size of the transform matrices.18. A method according to any one of clauses 13 to 17, comprising thestep of: deriving transform matrices at a required data precision fromrespective source transform matrices at a different data precision.19. A data encoding method for encoding an array of data values as datasets and escape codes for values not encoded by the data sets, an escapecode comprising a unary coded portion and a non-unary coded portion, themethod comprising the steps of:

setting a coding parameter defining a minimum number of bits of anon-unary coded portion, the coding parameter being between 0 and apredetermined upper limit;

adding an offset value of 1 or more to the coding parameter so as todefine a minimum least significant data portion size;

generating one or more data sets indicative of positions, relative tothe array of data values, of data values of predetermined magnituderanges, so as to encode the value of at least one least significant bitof each data value;

generating, from at least the part of each data value not encoded by theone or more data sets, respective complementary most-significant dataportions and least-significant data portions, such that themost-significant data portion of a value represents zero or more mostsignificant bits of that portion, and the respective least-significantdata portion represents a number of least significant bits of that part,the number of least significant bits being greater than or equal to theminimum least significant data portion size;

encoding the data sets to an output data stream;

encoding the most significant data portions to the output data stream;and

encoding the least-significant portions to the output data stream.

20. A method according to clause 19, in which:

the step of encoding the most significant data portions to the outputdata stream comprises encoding the most significant data portions to theoutput data stream using a unary code; and

the step of encoding the least-significant portions to the output datastream comprises encoding the least-significant portions to the outputdata stream using a non-unary code.

21. A method according to clause 19 or clause 20, in which the step ofencoding the data sets to an output data stream comprises encoding thedata sets to an output data stream using a binary code.22. A method according to any one of clauses 19 to 21, in which thesetting step comprises incrementing the coding parameter in dependenceupon the magnitude of a current data value in the array.23. A method according to any one of clauses 20 to 22, in which thesteps of encoding the most significant data portion and the leastsignificant data portion comprise encoding the encoding the mostsignificant data portion and the least significant data portion using aGolomb-Rice code or an exponential Golomb code.24. A method according to clause 23, in which:

the suffix length of the Golomb-Rice code is equal to the minimum leastsignificant data portion size; and

the exponential Golomb code has an order equal to the minimum leastsignificant data portion size.

25. A method according to any one of clauses 19 to 24, comprising thestep of generating the offset value in dependence upon a parameter ofthe array of data values.26. A method according to clause 25, in which the parameter of the arrayof data values comprises one or more selected from the list consistingof:

the number of data values in the array;

a type of data represented by the data values;

a quantisation parameter applicable to the array of data values; and

an encoding mode.

27. A method according to any one of clauses 19 to 26, comprising thestep of including data in a data header defining the offset value.28. A method according to clause 1, in which the encoding stepcomprises:

selecting one of a plurality of complementary sub-ranges of a set ofcode values according to the value of a current input data value of adata set for encoding, the set of code values being defined by a rangevariable;

assigning the current input data value to a code value within theselected sub-range;

modifying the set of code values in dependence upon the assigned codevalue and the size of the selected sub-range;

detecting whether the range variable defining the set of code values isless than a predetermined minimum size and if so, successivelyincreasing the range variable so as to increase the size of the set ofcode values until it has at least the predetermined minimum size; andoutputting an encoded data bit in response to each such size-increasingoperation; and

after encoding a group of input data values, setting the range variableto a value selected from a predetermined subset of available rangevariable values, each value in the subset having at least one leastsignificant bit equal to zero.

29. A method according to clause 28, in which:

the proportions of the sub-ranges relative to the set of code values aredefined by a context variable associated with the input data value.

30. A method according to clause 29, comprising the step of:

following the coding of a data value, modifying the context variable,for use in respect of a next input data value, so as to increase theproportion of the set of code values in the sub-range that was selectedfor the current data value.

31. A method according to any one of clauses 28 to 30, in which:

the set of code values comprises values from 0 to an upper value definedby the range variable, the upper value being between 256 and 510.

32. A method according to clause 31, in which:

the subset of available values of the range variable comprises the value256.

33. A method according to clause 31, in which:

the subset of available values comprises a set consisting of 256 and384;

the step of setting the range variable comprises selecting a value fromthe subset according to a current value of the range variable, so thatthe range variable is set to 256 if the current value of the rangevariable is between 256 and 383, and the range variable is set to 384 ifthe current value of the range variable is between 384 and 510.

34. A method according to clause 31, in which:

the subset of available values comprises a set consisting of 256, 320,384 and 448;

the step of setting the range variable comprises selecting a value fromthe subset according to a current value of the range variable, so thatthe range variable is set to 256 if the current value of the rangevariable is between 256 and 319, the range variable is set to 320 if thecurrent value of the range variable is between 320 and 383, the rangevariable is set to 384 if the current value of the range variable isbetween 384 and 447, and the range variable is set to 448 if the currentvalue of the range variable is between 448 and 510.

35. A method according to any one of clauses 28 to 34, comprising:

encoding data representing values which are not represented in a dataset as bypass data;

detecting the quantity of bypass data associated with a current array;and

applying the setting step if the quantity of bypass data exceeds athreshold amount, but not applying the setting step otherwise.

36. A method according to any one of clauses 28 to 35, in which the dataare encoded as transform units comprising a plurality of arrays of datavalues, the method comprising applying the setting step at the end ofencoding a transform unit.37. A method of encoding image data, comprising the steps of:

frequency-transforming input image data to generate an array offrequency-transformed input image coefficients by amatrix-multiplication process, according to a maximum dynamic range ofthe transformed data and using transform matrices having a dataprecision; and

selecting the maximum dynamic range and/or the data precision of thetransform matrices according to the bit depth of the input image data.

38. A method according to clause 37, in which, for input image datahaving image components of different bit depths, the selecting stepcomprises selecting a single set of the maximum dynamic range and/or thedata precision of the transform matrices for use with all of the imagecomponents.39. A method according to clause 38, in which the selecting stepcomprises selecting, as the single set of the maximum dynamic rangeand/or the data precision of the transform matrices, those valuesrelating to that one of the image components having the greatest bitdepth.40. Image data encoded by the encoding method of any one of thepreceding clauses.41. A data carrier storing image data according to clause 40.42. A data decoding method for decoding data to provide an array of datavalues, the method comprising the steps of:

separating, from an input data stream, least-significant data portionsof the data values and one or more encoded data sets;

decoding the data sets to generate most-significant data portions of thedata values using binary decoding; and

combining the most-significant data portions and the least-significantdata portions to form the data values, such that, for a data value, therespective most-significant data portion represent a plurality of mostsignificant bits of that data value, and the respectiveleast-significant data portion is dependent upon the remaining leastsignificant bits of that data value.

43. A data decoding method for decoding input data to provide an arrayof data values, the input data being encoded as data sets and escapecodes for values not encoded by the data sets, an escape code comprisinga unary coded portion and a non-unary coded portion, the methodcomprising the steps of:

setting a coding parameter defining a minimum number of bits of anon-unary coded portion, the coding parameter being between 0 and apredetermined upper limit;

adding an offset value of 1 or more to the coding parameter so as todefine a minimum least significant data portion size;

decoding one or more data sets indicative of positions, relative to thearray of data values, of data values of predetermined magnitude ranges,so as to decode the value of at least one least significant bit of eachdata value;

decoding at least the part of each data value not encoded by the one ormore data sets from the unary coded portion and the non-unary codedportion respective complementary most-significant data portions andleast-significant data portions, such that the most-significant dataportion of a value represents zero or more most significant bits of thatportion, and the respective least-significant data portion represents anumber of least significant bits of that part, the number of leastsignificant bits being greater than or equal to the minimum leastsignificant data portion size.

44. A method of decoding image data, comprising the steps of:

frequency-transforming input frequency-transformed image data togenerate array of output image data by a matrix-multiplication process,according to a maximum dynamic range of the transformed data and usingtransform matrices having a data precision; and

selecting the maximum dynamic range and/or the data precision of thetransform matrices according to the bit depth of the output image data.

45. A method according to clause 44, in which, for input image datahaving image components of different bit depths, the selecting stepcomprises selecting a single set of the maximum dynamic range and/or thedata precision of the transform matrices for use with all of the imagecomponents.46. A method according to clause 45, in which the selecting stepcomprises selecting, as the single set of the maximum dynamic rangeand/or the data precision of the transform matrices, those valuesrelating to that one of the image components having the greatest bitdepth. 47. Computer software which, when executed by a computer, causesthe computer to carry out the method of any one of clauses 1 to 39 and42 to 46.48. A non-transitory machine-readable storage medium on which computersoftware according to clause 47 is stored.49. Data encoding apparatus for encoding a sequence of data values, theapparatus comprising:

a generator configured to generate, from the input data values,respective complementary most-significant data portions andleast-significant data portions, such that the most-significant dataportion of a value represents a plurality of most significant bits ofthat value, and the respective least-significant data portion isdependent upon the remaining least significant bits of that value andconfigured to generate one or more data sets indicative of positions,relative to the array of the values, of most-significant data portionsof predetermined magnitude ranges; and

an encoder configured to encoding the data sets to an output data streamusing binary encoding and to include data defining the least-significantportions in the output data stream.

50. Data encoding apparatus for encoding an array of data values as datasets and escape codes for values not encoded by the data sets, an escapecode comprising a unary coded portion and a non-unary coded portion, theapparatus comprising:

a processor configured to:

set a coding parameter defining a minimum number of bits of a non-unarycoded portion, the coding parameter being between 0 and a predeterminedupper limit;

add an offset value of 1 or more to the coding parameter so as to definea minimum least significant data portion size;

generate one or more data sets indicative of positions, relative to thearray of data values, of data values of predetermined magnitude ranges,so as to encode the value of at least one least significant bit of eachdata value; and

generate, from at least the part of each data value not encoded by theone or more data sets, respective complementary most-significant dataportions and least-significant data portions, such that themost-significant data portion of a value represents zero or more mostsignificant bits of that portion, and the respective least-significantdata portion represents a number of least significant bits of that part,the number of least significant bits being greater than or equal to theminimum least significant data portion size;

and an encoder configured to:

encode the data sets to an output data stream;

encode the most significant data portions to the output data stream; and

encode the least-significant portions to the output data stream.

51. Data encoding apparatus for encoding image data, the apparatuscomprising:

a frequency transformer configured to frequency-transform input imagedata to generate an array of frequency-transformed input imagecoefficients by a matrix-multiplication process, according to a maximumdynamic range of the transformed data and using transform matriceshaving a data precision; and

a selector configured to select the maximum dynamic range and/or thedata precision of the transform matrices according to the bit depth ofthe input image data.

52. Apparatus according to clause 51, in which, for input image datahaving image components of different bit depths, the selector isconfigured to select a single set of the maximum dynamic range and/orthe data precision of the transform matrices for use with all of theimage components.53. Apparatus according to clause 52, in which the selector isconfigured to select, as the single set of the maximum dynamic rangeand/or the data precision of the transform matrices, those valuesrelating to that one of the image components having the greatest bitdepth.54. Data decoding apparatus for decoding data to provide an array ofdata values, the apparatus comprising the steps of:

a data separator configured to separate, from an input data stream,least-significant data portions of the data values and one or moreencoded data sets;

a decoder configured to decode the data sets to generatemost-significant data portions of the data values using binary decoding;and

a combiner configured to combine the most-significant data portions andthe least-significant data portions to form the data values, such that,for a data value, the respective most-significant data portion representa plurality of most significant bits of that data value, and therespective least-significant data portion represents the remaining leastsignificant bits of that data value.

55. Data decoding apparatus for decoding input data to provide an arrayof data values, the input data being encoded as data sets and escapecodes for values not encoded by the data sets, an escape code comprisinga unary coded portion and a non-unary coded portion, the apparatuscomprising:

a processor operable to set a coding parameter defining a minimum numberof bits of a non-unary coded portion, the coding parameter being between0 and a predetermined upper limit; to add an offset value of 1 or moreto the coding parameter so as to define a minimum least significant dataportion size; to decode one or more data sets indicative of positions,relative to the array of data values, of data values of predeterminedmagnitude ranges, so as to decode the value of at least one leastsignificant bit of each data value; and to decode at least the part ofeach data value not encoded by the one or more data sets from the unarycoded portion and the non-unary coded portion respective complementarymost-significant data portions and least-significant data portions, suchthat the most-significant data portion of a value represents zero ormore most significant bits of that portion, and the respectiveleast-significant data portion represents a number of least significantbits of that part, the number of least significant bits being greaterthan or equal to the minimum least significant data portion size.

56. Image data decoding apparatus comprising:

a frequency transformed configured to frequency-transform inputfrequency-transformed image data to generate array of output image databy a matrix-multiplication process, according to a maximum dynamic rangeof the transformed data and using transform matrices having a dataprecision; and

a selector configured to select the maximum dynamic range and/or thedata precision of the transform matrices according to the bit depth ofthe output image data.

57. Apparatus according to clause 56, in which, for input image datahaving image components of different bit depths, the selector isconfigured to select a single set of the maximum dynamic range and/orthe data precision of the transform matrices for use with all of theimage components.58. Apparatus according to clause 57, in which the selector isconfigured to select, as the single set of the maximum dynamic rangeand/or the data precision of the transform matrices, those valuesrelating to that one of the image components having the greatest bitdepth.59. Video data capture, transmission, display and/or storage apparatuscomprising apparatus according to any one of clauses 49 to 58.

As discussed earlier, it will be appreciated that apparatus features ofthe above clause may be implemented by respective features of theencoder or decoder as discussed earlier.

1. (canceled) 2: A method for encoding remainder values for videorepresented by transform coefficients which have not been described inother encoded values, the method comprising: generating the remaindervalue comprising a prefix followed by a suffix by using a parametervalue which when combined with the prefix defines the length in bits ofthe suffix and wherein said parameter value is varied based on priorencoding states of coefficients included in previous coefficient groups.3: The method according to claim 2, wherein the previous coefficientgroups are 4×4 blocks of coefficients. 4: The method according to claim2, wherein the previous coefficient groups form part of the same slice.5: The method according to claim 4, wherein an offset to the parametervalue is reset for a next slice. 6: The method according to claim 2,wherein the parameter is varied by ensuring that an offset is not resetfor every coefficient group. 7: The method according to claim 2, whereinthe coefficient group includes all the coefficients of a transformoperation. 8: The method according to claim 2, wherein the coefficientgroup includes all the coefficients of a transform unit (TU). 9: Themethod according to claim 2, wherein at least a previous coefficientgroup some coefficients have first been encoded according to asignificance map. 10: The method according to claim 9, wherein theparameter value is varied based on the encoding of remainder values notencoded according to the significance map. 11: The method according toclaim 2, wherein the other encoded values are represented bysignificance maps. 12: The method according to claim 2, wherein theremainder values are coefficients values minus a base level value inrespect of significance maps which describe the other encoded values.13: The method according to claim 2, wherein the base level for acoefficient is dependent on the number of significance maps availablefor that coefficient. 14: A non-transitory computer readable mediumincluding computer program instructions, which when executed by acomputer causes the computer to perform the method of claim
 2. 15: Adata encoding apparatus for encoding remainder values for videorepresented by transform coefficients which have not been described inother encoded values comprising: a processor configured to generate theremainder value comprising a prefix followed by a suffix by using aparameter value which when combined with the prefix defines the lengthin bits of the suffix and wherein said parameter value is varied basedon prior encoding states of coefficients included in previouscoefficient groups. 16: The apparatus according to claim 15, wherein theprevious coefficient groups are 4×4 blocks of coefficients. 17: Theapparatus according to claim 15, wherein the previous coefficient groupsform part of the same slice. 18: The apparatus according to claim 17,wherein an offset to the parameter value is reset for a next slice. 19:The apparatus according to claim 15, wherein the parameter is varied byensuring that an offset is not reset for every coefficient group. 20:The apparatus according to claim 15, wherein the coefficient groupincludes all the coefficients of a transform operation. 21: Theapparatus according to claim 15, wherein the coefficient group includesall the coefficients of a transform unit (TU). 22: The apparatusaccording to claim 15, wherein at least a previous coefficient groupsome coefficients have first been encoded according to a significancemap. 23: The apparatus according to claim 22, wherein the parametervalue is varied based on the encoding of remainder values not encodedaccording to the significance map. 24: The apparatus according to claim15, wherein the other encoded values are represented by significancemaps. 25: The apparatus according to claim 15, wherein the remaindervalues are coefficients values minus a base level value in respect ofsignificance maps which describe the other encoded values. 26: Theapparatus according to claim 15, wherein the base level for acoefficient is dependent on the number of significance maps availablefor that coefficient. 27: A video processing device including theapparatus of claim
 15. 28: A video capture device including theapparatus of claim 15, further including a CABAC encoder for CABACencoding the remainder values to a bitstream and a decoder configured todecode the bitstream.